-->
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: One-to-Many-to-Many with Lists
PostPosted: Sun Jan 18, 2004 1:44 am 
Newbie

Joined: Tue Sep 30, 2003 11:00 am
Posts: 1
Hi,

I have a case that could be described as follows:

Object A has a List of B's.
Each B has a List of C's.

I cannot successfully map the entire relationship.

I have been able to do map and persist the A-to-B relationship by including a <list>, <key>, <index> and <composite-element> in A's <class> area.

To map the B-to-C relationship, I tried to include a <list> for C in B's <composite-element> area. For C, I identitifed two key columns, a_id and b_id, and an index c_pos.

Hibernate flagged the <list> as an invalid token within <composite-element>.

Looking at the documentation, and at the complaint from Hibernate, it appears that <nested-composite-element> may come into play. But I will be darned if I can find any documentation or examples of this on the web.

(As a side note, I have been able to successfully persist this type of relationship(s) using Sets, but the client-side programmers are insistant on using Lists in this case.)

What do I need to do? (Or where can I go to find the info?)

I can provide more detailed info if needed (i.e. class, maps, schema).

Thanks so much!

Brian Kuhn


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 18, 2004 6:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Have you read http://www.hibernate.org/hib_docs/reference/html/parent-child.html ? I don't see the need to use composite-element in this case. Note however that lists are not officially supported for bidirectional one-to-manys. There are workarounds, search the forum.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2004 2:22 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
You can't map it as a composite-element, composite-element does not support one-to-many association to other elements.
Map it using an entity

_________________
Emmanuel


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.