Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

updating and adding data in HashSet in Hibernate Layer

 
Monty Panesar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monty Panesar, please check your private messages for a message from me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic