This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
>> 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.