This week's book giveaway is in the Java 9 forum. We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line! See this thread for details.
Hibernate 2: hsess.refresh(book); (or "is anything changed in the db")
posted 8 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.