Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate 2: hsess.refresh(book); (or "is anything changed in the db")

John Landon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets say I have 2 fields in book. I retrieved book from the db. Changed one of the fields using a set method of the class. Now, some other process might have changed the other field and persisted the book into the db.
So now I want to check if this happened. what I want to do is hsess.refresh(book) to get the updated version form the db do verify that the second field has the value I need. But what I am afraid off is that the first field that I changed in this thread will be overridden. I want to get all the fields of the object but not to override the ones I just changed.

What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!