The following three statuses are processed in hibernate: transient, persistent, and detached.

Source: Internet
Author: User

1. Features of the transient status:
* No matching data exists in the database.
* Not included in session management
2. Features of the persistent state:
* Objects in the persistent State have matched data in the database.
* Added session management.
* When the cache is cleared (dirty data check), it will be synchronized with the database
3. Features of the detached status:
* Matched data exists in the database.
* Not included in session management
Difference between the detached status and the transient status
The object in the transient (Free State) State has nothing to do with the records in the database table. You cannot find the corresponding records in the database based on the information in the transient object.
Although the detached (Free State) State object is detached from the session instance, it can find the data records corresponding to the table in the database based on the information. For example, if the database table record with the corresponding ID of a table has been deleted, the object has no correspondence with the record in the database table, so it is in the transient state.

This article is transferred from www.35java.com

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.