aspose file tools
The moose likes Object Relational Mapping and the fly likes hibernate values update Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "hibernate values update" Watch "hibernate values update" New topic
Author

hibernate values update

jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
Hi All,

I was trying to update or save using one to many. Here I am using Set. How to save the data into database in the order of the entered details.

I tried to use arraylist but I see arraylist works based on the index column which we dont have.

Thanks,
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4967

How to save the data into database in the order of the entered details.


How are the details ordered?


Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
jaisai vijay
Ranch Hand

Joined: Dec 17, 2009
Posts: 70
Hi,

I think Set is unordered If I add values to Set value will be added at the some position not to the first position. I saw this when I debug the code.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4967

How to save the data into database in the order of the entered details.


I guess I'm just wondering why it's important to save them in the same order? Really, all you want to do is save it, right? You can order it any way you want when you pull it out of the database.

Saving a set should just be standard Hibernate code. I don't think there's any special magic you need to perform.
Ganesh Shirsat
Ranch Hand

Joined: Jan 10, 2010
Posts: 30

hi friends,

i think you should use the Bag or list mapping instead of set.

and add the record in arraylist according to input or order in which you want.

it will stored in sequence according to arraylist.

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: hibernate values update
 
Similar Threads
Is this a bad way to approach things?
validation.xml is miss firing
persistence issue!
hiberante Many-to-Many: save
question about ArrayList