Transitions between states in Hibernate 3

Source: Internet
Author: User
Tags garbage collection
Transitions between states in Hibernate 3

Different persistence operations in Hibernate can cause changes in the state of the object
As shown in the following illustration:

Objects built with the New keyword are transient states.
1. Transient state transitions to persistent state using the Session object's Save () or Saveorupdate () method to hold the object, the state of the object is converted from the transient state to the persisted state using the get () or load () of the Session object After a method gets an object, the state of the object is persisted state 2, the persisted state transitions to the instantaneous state of the Delete () method that executes the session object, and the object is changed from the original persistent state to the instantaneous state, so the object is not associated with any database data 3, The persistent state becomes Free State executes the evict (), clear (), close () method of the Session object, and the object is changed from the original persistent state to the Free State. 4, the Free State is converted to a persistent state to regain the session object, execute the Session object's update () or Saveorupdate () method, from the Free State to a persistent state, the object is again associated with the session. 5, the Free State transitions to the instantaneous state execution session of the Delete () method, the object has a free state into a transient state, the transient state or the Free State of the object is no longer referenced by other objects, the Java virtual machine is processed by the garbage collection mechanism

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.