-->
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.  [ 3 posts ] 
Author Message
 Post subject: Inverse is not supported for idbag in DTD
PostPosted: Wed Apr 21, 2004 7:03 am 
Newbie

Joined: Fri Feb 27, 2004 6:49 pm
Posts: 18
Location: Paris, France
The 2.0 DTD does not support to have an inverse attribute on an idbag.

<!ELEMENT idbag (
meta*,
(cache|jcs-cache)?,
collection-id,
key,
(element|many-to-many|composite-element|many-to-any)
)>
<!ATTLIST idbag name CDATA #REQUIRED>
<!ATTLIST idbag access CDATA #IMPLIED>
<!ATTLIST idbag table CDATA #IMPLIED> <!-- default: name -->
<!ATTLIST idbag schema CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag lazy (true|false) "false">
<!ATTLIST idbag cascade (none|all|save-update|delete|all-delete-orphan|delete-orphan) #IMPLIED> <!-- default: none -->
<!ATTLIST idbag order-by CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag where CDATA #IMPLIED> <!-- default: none -->
<!ATTLIST idbag batch-size CDATA "1">
<!ATTLIST idbag outer-join (true|false|auto) "auto">
<!ATTLIST idbag check CDATA #IMPLIED> <!-- default: none -->

Is it really unsupported? If yes, why is that so?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 21, 2004 8:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
It doesn't make sense for an <idbag>. Just use a <bag> instead :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 21, 2004 11:35 am 
Newbie

Joined: Fri Feb 27, 2004 6:49 pm
Posts: 18
Location: Paris, France
Why? I have a table with the following format:

ID
INX_TO
INX_FROM
ASSOCIATION_TYPE

To regroup some reflexive associations. There are different types of associations (ASSOCIATION_TYPE). An idbag is nice because I can remove or add associations without always removing all the list.

To mapping look like this:

<idbag name="duplicateDaughters" table="inx_reflexive" where="association_type='DUPLICATED'" lazy="true">
<collection-id column="ID" type="long">
<generator class="sequence">
<param name="sequence">INX_REFLEXIVE_DB_ID</param>
</generator>
</collection-id>
<key column="inx_from"/>
<composite-element class="InxReflexive">
<property name="duplicated" column="association_type"/>
<many-to-one name="inxTo" class="Inx" column="inx_to"/>
</composite-element>
</idbag>

So we are using a composite element to map the association type. In this case, I also have a duplicateMother mapping. So duplicateDauthers should be the inverse of duplicateMother (which is in fact a one-to-many).

Where doesn't it make sense?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.