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

Entity Life Cycle

 
Satyajeet Kadam
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q1) Please correct me if i am wrong?

new/Transient State------persist()-----------------Managed State

Manged State ---------- Commit()or rollback()--Detached State

Detached State---------merge()or find()------ ---Managed State


Managed State -------------remove()-------------Removed State


Is there anything i am missing out?


 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>> Manged State ---------- Commit()or rollback()--Detached State

rollback will detach everything, however a commit using a JPA transaction will continue the persistence context, so the objects will remain managed unless you call clear.
If using a JTA (EJB) transaction, then commit will detached everything.

>> Detached State---------merge()or find()------ ---Managed State

merge with "return" a managed object, the object being merged will remain detached.
Find will return a managed object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic