• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database change without update

 
Samanthi perera
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my main class


this is the output


my problem is i save the person Young Shin on line no 29 and I read that value on line no 34.After that i change tha value,But i didn't updated session.the how the database change?

 
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
Hibernate collects all of the changes to the object, and then persists any updates or changes to the object when the commit happens. If you don't want the new value to be updated at the commit, you need to evict the object from the session, or update the value before the commit.

You might find this little tutorial on how hibernate works to be very helpful in this regard:

How Hibernate and the Hibernate Session Works

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic