Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate : @Version and merge

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally, I use merge for saveNew and update, it works. Then I add version controll number in, saveNew is fine, but update will generate a new instance, not an update.

In my object, I have one-to-one and one-to-many, what I want is, when save new or update, always get latest copy (including parent and child object), merge together, and then do save-new or update. But @Version doesn't help. Or when we use merge, we don't need @Version ? because merge will guarantee the object is having latest data.

How to work out ? please help.

Thanks.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic