Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

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.

The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic