Hibernate Framework Learning 3

Source: Internet
Author: User

One-to-many |

One-to-many

Many-to-one

Cascade Operations

Conclusion: Simplify the operation. Be sure to use, save-update, delete is not recommended.

Relationship Maintenance

On save. Two parties maintain foreign key relationships. Relationship Maintenance two times, redundant.
Redundant maintenance relationship statements, apparently the customer is maintaining the relationship at the end of the

Many-to-many

Inverse property

Cascading properties

Inquire

1.oid Query-get

2. Object property Navigation Query

Query-HQL syntax

Basic syntax

Sort

Conditions

Page out

Polymerization

Projection

Multi-Table Query

HQL

HQL syntax

Internal connection

Left outer link

Right outer connection

Query-criteria syntax

Conditions

Page out

Sort

Statistics

Offline query

Non-offline

Query optimization

Class-Level queries

Get method: There is no policy. The call immediately queries the database to load the data.

Load method: Apply the load policy at the class level

Lazy (default): True, the proxy object is returned when the class is queried. The database is queried against the associated session when the attribute is used. Loads the data.

Lazy:false. The Load method has no difference from the Get method. Loads the data when it is called.

Conclusion: To improve efficiency. Lazy Loading is recommended

Note: When using lazy loading, make sure that the session is open when the call property loads the data. Otherwise it throws an exception.

Association level Query

Collection Policy

Association Property Policy

Conclusion: In order to improve efficiency, select should be selected on the fetch. The value of lazy should be selected as true. Use all default values.

No-session Problem Solving: Expanding the scope of the session.

Batch Crawl

Hibernate Framework Learning 3

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.