How hibernate delays Loading

Source: Internet
Author: User

How hibernate delays loading:

When Hibernate is set to a delayed loading policy, an instance of the proxy class is returned after the query:

Proxy features:

1. Hibernate is dynamically generated at runtime. It extends the persistence class. Therefore, all attributes and methods of the persistence class are implemented.ProgramIs transparent (that is, the application cannot see this proxy class)

2. hibernate creates a proxy class instance. It only initializes its OID attribute.

3. When the application accesses the proxy class attributes for the first time, other attributes of the proxy class are initialized. (In addition to accessing the oId attribute, it is not necessary to check the oId in the database because it has already been started .)

The get () method always loads immediately. this is also a difference between get () and load. another difference is that if no results in the database get () return null and load (); an error is returned.

 

 

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.