-->
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.  [ 4 posts ] 
Author Message
 Post subject: list instead of set for OneToMany relations
PostPosted: Thu Apr 15, 2010 4:43 am 
Newbie

Joined: Thu Sep 03, 2009 12:37 pm
Posts: 13
Hi,

is there any documentation how to create lists instead of sets for 1:n relations? Currently the hibernate tools create (Hash)sets, which would need more effort to sort. I saw that there are hbm templates for list, how can I use them? I tried to replace the content of set.hbm.ftl with the list, but that caused an error. I think there's some logic in the classes for reverse engineering to control that.

I think I know how to manually do that, but I have ~20-30 tables, and I would also have to change the java part, which currently uses sets, too.

Can't imagine, that these template files are without any usage included for two years or more, so..help me please :)


Top
 Profile  
 
 Post subject: Re: list instead of set for OneToMany relations
PostPosted: Thu Apr 15, 2010 5:11 am 
Senior
Senior

Joined: Tue Aug 04, 2009 7:45 am
Posts: 124
When you replace the code in template you should take into account that in Set.ftl property's value has org.hibernate.mapping.Set class, but in list org.hibernate.mapping.List. So you must change the template so it call only existing method from the value. For example Set class hasn't methods get/setBaseIndex, get/setIndex...


Top
 Profile  
 
 Post subject: Re: list instead of set for OneToMany relations
PostPosted: Thu Apr 15, 2010 5:17 am 
Newbie

Joined: Thu Sep 03, 2009 12:37 pm
Posts: 13
I already guessed that...and how do I use list.hbm.ftl correctly?


Top
 Profile  
 
 Post subject: Re: list instead of set for OneToMany relations
PostPosted: Thu Apr 15, 2010 5:24 am 
Senior
Senior

Joined: Tue Aug 04, 2009 7:45 am
Posts: 124
Nowise without changes.
But you could remove all wrong method calles and use "truncated" version of list template.


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