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