-->
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.  [ 5 posts ] 
Author Message
 Post subject: SortedSet vs List
PostPosted: Fri May 14, 2004 11:23 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
Hi everyone,

i'm trying to order elements of a one-to-many relation

say
<class name="DossierFormation" table="DOSSIER_FORMATION">

<set name="engagements" inverse="true" lazy="true" sort="EngagementComparator" cascade="all-delete-orphan">
<key column="ENGAGEMENT_DOSSIER_FORMATION_ID_FK"/>
<one-to-many class="org.xx.engagementremboursement.model.Engagement"/>
</set>
<class>

So I currently have a sorted set.
the problem is that I create to many engagement at once and they all have the same date. So many are not included in the TreeSet().
Moreover I have to implement a compareTo() method in the automatically generated Engagement class, due to the TreeSet (only implementation of sorted set). So it breaks the automatic process.

I've got no field that can be use as index, except the id, but it doesn't exist when the object is transcient.

I was thinking of using a list mapping and thus creating a dedicated index column but I can't find in the doc whether I'll have to fill this attribute or if it will automatically inserted and incrmented by hibernate at creation time?

any input on this??

thanks,
nodje


Last edited by nodje on Tue Jun 03, 2008 5:35 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri May 14, 2004 12:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
The index column will of course be automatically managed by Hibernate. Note however that Lists are really not good and not officially supported for parent-child relationships, should this be one.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 14, 2004 12:18 pm 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
what do you mean by "not officially supported", it's in the documentation right?

Why is it so bad?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 14, 2004 12:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
http://www.hibernate.org/193.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 14, 2004 12:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
It is also in the documentation that it is not supported, right at: http://www.hibernate.org/hib_docs/reference/en/html/collections.html#collections-bidirectional - No problem for unidirectional associations though


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