Hibernate persistent objects three states and their transformations

Source: Internet
Author: User

three states of persistence class class introduction
1.Transient state: Also known as temporary state or Free State, which generally refers to ourNewOut of the object that it does not existOid
AndHibernate sessionNo association, and no records in the database. When it is finished, it will beJvmDirect
Recycled, it's just for information to carry.
Simply put: noOidis not associated with the information in the database and is notsession within the scope of management.
2. hibernate Class= "FONTSTYLE0" > within the scope of management, it has a persistent identity oid service is not committed until it has been persistent state, When it changes, hibernate simply say: There are oid session Management, there may be in the database, there can be no.
3. managed State: Also known as a Free State or off-line state, it refers to the persistent state object lost with Tubular object It exists oid,  There may or may not exist in the database.
for a managed state object, it changes when hibernet cannot be detected.

 

persisted class three state toggle
/span>

/span>

1.Instantaneous state(NewOut of)
Instantaneous------>LastingSave Saveorupdate
Instantaneous----->Off-Tube(Free)Manually setOid
2.Persistent state it is bySessionManagement
Lasting------->InstantaneousDelete ()The persisted object is not recommended when it is deleted
Lasting-----> off the tube note :session its cache is what it says the first level of cache
evict ( Span class= "Fontstyle2" to clear one object specified in the first-level cache )
Clear ( Close ( Close, empty cache 3. off-pipe (it is not directly available)
off-pipe -----> instantaneous direct oid remove
Off-pipe ----> durable Update saveorupdate Lock ( obsolete )

Hibernate persisted object three states and their transformations

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.