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
|
|