Hibernate 2: hsess.refresh(book); (or "is anything changed in the db")
posted 7 years ago
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.