Lazy is valid: only open in the session when it effective; session after the closure of a lazy no effect.
lazy strategy can be used in:
* <class> Tab: takes the value true / false
* <property> Label, takes the value true / false, this feature requires the class to enhance
* <set> / <list> Other collections, it can be a value of true / false / extra
* <one-to-one> / <many-to-one> Other tab, you can value false / proxy / no-proxy
6.1 get and load the difference between:
* Get does not support lazy loading, and load support.
* When the query does not exist in a particular database the data, get returns null, and the load is thrown.
Class 6.2 (Class) lazy loading:
* Set <class> tab lazy = "true", or keep the default (that is not configured lazy properties)
* If the lazy attribute to true, then use the Load method to load data only when the data actually used in the sql statement will be issued; this may reduce the system overhead.
* / / Will not issue the query sql
System.out.println ("group" + group.getId ());
There is a problem, why not add the primary key issue when the sql statement.
6.3 set (collection) of the lazy: takes the value true, false, extra
* Keep the default set of values on the lazy, the effect of time and lazy = "extra" is basically the same.
* Set a collection of lazy = extra, time effects and lazy attribute default value is essentially the same. However, the value of this property is recommended, because in this case when the statistics become more intelligent. Of course, there is a delay effect.
* Set a collection of lazy = false
true: The default value, which means that only when you call the elements of the collection object to get inside before issuing the query, load the collection of data elements
false: Cancel lazy loading feature that the object is loaded at the same time, it issued a second query to load the associated data collection
extra: a more clever lazy loading strategy that calls a collection of size / contains methods such as time, hibernate
Not to load the entire collection of data, but a smart SQL statement issued to obtain the desired value, only really need to use these elements of the collection object data when it issued a query to load all objects data
6.4 Hibernate single-ended associations, lazy loading strategy: that is, in <one-to-one> / <many-to-one> label can be configured
Lazy loading strategy. Takes the value of: false / proxy / no-proxy
false: Cancel lazy loading strategy, that is loading the object at the same time, send query to load the associated object
proxy: This is for single-ended associations hibernate lazy load the default strategy, that only calls to the method of its associated object when it is actually query the object issuing the query data, its associated object is the proxy class
no-proxy: This lazy loading feature class needs to be enhanced using the no-proxy, the proxy class object is not associated
Note: In the class label does not affect the configuration of the lazy attribute to the associated object!!!
Related Posts of Detailed usage of the hibernate lazy
hibernate lock mechanism 1. Pessimistic lock It refers to the modification of data by outsiders hold a conservative attitude. The assumption that at any time access to data, may also have another client to access the same data, in order to maintain t ...
Private http://www.lifevv.com/tenyo/doc/20070605102040991.html c3p0 for open source's JDBC connection pool, with the release hibernate. This article describes how to use the hibernate configuration in c3p0. c3p0 connection pool configuration is v ...
Hibernate in the configuration file: <properties> <property name="hibernate.hbm2ddl.auto" value="create" /> </ properties> Parameter Description: validate load hibernate, the authentication to create a database t ...
Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the orientation of selection create project from exis ...
Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.132:15
package org.lzpeng.dao; import java.io.Serializable; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *
dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q
Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...
hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...