-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: XML Entity and Component/Composite-Element
PostPosted: Wed Jan 30, 2008 5:28 pm 
Newbie

Joined: Thu Nov 01, 2007 11:14 am
Posts: 5
Location: Austin, TX
I have a class (Address) that is sometimes used as a component (for example, when storying a Company, which only has a main address) and other times as a composite-element (when storing a Person, which has multiple addresses).

Is there any way to keep the mapping definition of this element in only one file? The XML Entity include solution would require at least two (one for the component type and one for the composite element type).

For example I've got:

Code:
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
      "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
        [ <!ENTITY compositeAddress SYSTEM "classpath://mappings/compaddress.xml"> ]>


At the top of Person, and:

Code:
<composite-element class="esta.dataobjects.Address">
    <property name="streetAddress" not-null="true" />
    <property name="aptNumber" />
    <property name="city" not-null="true" />
    <many-to-one name="state" class="esta.dataobjects.State"
        not-null="true" />
    <property name="postalCode" not-null="true" />
</composite-element>


is in compaddress.xml. But since Company has only one address, it needs a <component> element, not a <composite-element> element (which is used in Person for an AddressType->Address map).

I don't want to store Address as a separate entity.

Any solutions?

PS: The error code when Hibernate can't find a file referenced in an ENTITY declaration on the classpath is "protocol not supported: classpath". Classy, no?


Top
 Profile  
 
 Post subject: Bump
PostPosted: Wed Feb 13, 2008 12:57 am 
Newbie

Joined: Thu Nov 01, 2007 11:14 am
Posts: 5
Location: Austin, TX
I'm bumping this because I haven't gotten any responses. I'd really like some sort of help.[/i]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.