• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate values update

 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to save the data into database in the order of the entered details.


How are the details ordered?
 
jaisai vijay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
Google Web Toolkit Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic