This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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.