-1

Does merge() in Hibernate save data in the database or just attach the object to persistent state? Is it necessary to call the update() method to persist the state subsequently?

karel
  • 5,489
  • 46
  • 45
  • 50
Ripudaman Singh
  • 363
  • 3
  • 10
  • This question got some negative reviews and it was downvoted, but all this happened before I edited it. Maybe it's a better question now than it was before I edited it. – karel Mar 28 '19 at 05:10
  • 2
    If you want to save your modifications at any time with out knowing about the state of an session, then use `merge()` in hibernate. And you need to call `update()` to save modifications in database. – Sudhir Ojha Mar 28 '19 at 05:12

1 Answers1

1

merge() just add object to transaction unit and any operation after that will be part of change log in memory. update has to be called explicitly in order to persist state.