hibernate in the use of lazy
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!!!