Click here - / @interviewdot to get notifications. Transient State:A New instance of a persistent class which is not associated with a Session, has no representation in the database and no identifier value is considered transient by Hibernate:
UserDetail user = new UserDetail();
user.setUserName("InterviewDot"); // user is in a transient state
Persistent State:A persistent instance has a representation in the database , an identifier value and is associated with a Session. You can make a transient instance persistent by associating it with a Session:Long id = (Long) session.save(user); // user is now in a persistent state
Transient, Persistent and Detached Objects in Hibernate ?
Detached State:Now, if we close the Hibernate Session, the persistent instance will become a detached instance: it isn't attached to a Session anymore (but can still be modified and reattached to a new Session later though).session.close(); //user in detached state
One Click Dream Job http://www.interviewdot.com/upload-re...
Free Interview Books Download http://www.interviewdot.com/main-page...
Other Top Job Portals
www.naukri.com
www.monsterindia.com
www.timesjobs.com
www.freshersworld.com