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

em.merge Persistence Issue

 
Sri Datta
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a fairly standard code like this.



And in Action Class, I have two methods each of which corresponds to two buttons in the page.



1) I am saving a child by clicking a button and thus invoking saveChild(). -----I have observed that changes are saved in database.

2) I am saving Parent by clicking another button and thus invoking updateParent(). -----I have observed that the previously persisted changes are still in database

3) Now when I try to save another child by invoking saveChild(), the previously saved changes are overwritten resulting in newly saved changes only.

When I try to inspect the Parent object before it is sent for em.merge in Step(3), it still has all the proper data (I mean I can see both saved childs).

If I try the above steps in the order (1),(3),(2) everything is absolutely fine. Please help me understand this issue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic