Four states of entity class objects in Hibernate

Source: Internet
Author: User

1. Temporary status (transient):
Created with the new statement, it is not persisted and is not in the session's cache.
ID: OID is null, no relationship is established with session.
2. Persistent State (persistent):
is scheduled to be persisted and added to the session's cache. (Why plan: If a transaction has been committed because of a transaction issue)
ID: OID is not NULL, establishes a relationship with session.
3, delete the state (removed):(can regardless, if said three states, is not this kind)
is not in the session cache, and the session is scheduled to delete it from the database.
Identity: OID is not null and is scheduled to be removed from session.
4. Off-tube status (detached):
has been persisted, not in the session cache
ID: OID is not NULL, no relationship is established with session.

Four states of entity class objects in Hibernate

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.