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.
The moose likes Object Relational Mapping and the fly likes  Entity Life Cycle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark " Entity Life Cycle" Watch " Entity Life Cycle" New topic
Author

Entity Life Cycle

Satyajeet Kadam
Ranch Hand

Joined: Oct 19, 2006
Posts: 215
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

Joined: Oct 01, 2007
Posts: 553
>> 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.


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Entity Life Cycle
 
It's not a secret anymore!