-->
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.  [ 1 post ] 
Author Message
 Post subject: how to handle hashset in one to many relationship
PostPosted: Wed Oct 03, 2007 3:40 pm 
Newbie

Joined: Wed Oct 03, 2007 3:35 pm
Posts: 1
Hi All,

I don't find it right thats why I am keeping it for open discussion.I have got many to one relation in my Hibernate tables..

Lets say I have got one Advert table and it has got many options that is linked in different table Advert_Options.In addition to this I have got one Options_Definition table that basically stores various options with Ids its kind of static data that is defined in this table.Now whenever there is any entry in advert_options table i associate the options from the options definition table.

In my requirement I have got one UI that presents few advertising options to the user that basically through checkboxes...Now user can select these advert options from the UI..

Now my problem is I get HashSet as a collection mapping from Hibernate reverse engineered code ..and I can't add additional new options while iterating through the set...

One option is in one time I make calls for update and removal calls..and for adding I handle it separately..

Right Now I convert my HashSet collection in the List and throught ListIterator I basically travese through options and update this list for new enteries or update previous enteries..

In the end I convert my List to HashSet...and I am put it back to my Advert Object..I am not happy with this approach as I believe I am missing something in using the hibernate..there should be some other good method to handle this scenario..

Please guide


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

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.