Three states of Hibernate objects

Source: Internet
Author: User

 object in the first state of Teacher T=NewTeacher (); T.setname ("Zhang San"); T.setage (35); Session Session=sessionfactory.getcurrentsession (); Session.begintransaction (); the object is in the second state of Session.save (t); Session.gettransaction (). commit ();  The object is in the third State, after commit. 1.transient: An object that is new in memory, no ID, no cache.2. Persistent: In memory, in cache, with database (ID)3.   detached: In memory, there is no cache, there are in the database. Hibernate Get Load1. Get go directly to the database to fetch records2.load returns a proxy object, which emits SQL when the content is actually used

Three states of Hibernate objects

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.