lazy « Default « JPA Q&A

1. default-lazy="false" and lazy="false" not working?

Hi, I've got a Hibernate mapped object that contains a set of other object that contains a set of user defined type enums. I'm setting default-lazy="false" at the top of my mapping file and even setting lazy="false" on the two levels of collections, but if I don't force the object to be fully loaded as soon as I get it back ...

2. Can I add lazy="true" to all tables by default?

Hibernate version: 2.1.6 We had some major performance problems with retrieving data from a table with several many-to-one relationships; problem solved by adding lazy="true" to the 'to-one' table. There are many complex relationships in our data model; a good number of them are on the to-one side of many-to-one relationships. Is it ok to simply add lazy="true" to every table by ...

3. default-lazy="false" caused an infinite loop

Hibernate version: 3.02 Mapping documents:

4. 3.1rc3 - default lazy="false"! how comes?

we are in the process of migrating our app from 3.0.5 to 3.1rc3 a major issue is that hibernate rc3 appears to operate in default lazy mode = false! --> all associations are being loaded resulting in tremendous overhead! Is this intended? Or any change in SessionFactory settings needed to explicitly enable default lazy = true ?

5. How do I set lazy="false" globally as a default?

You know, I found this before, and obviously missed the last line... *********Migration guide*********** Association fetching strategies Since it is best practice to map almost all classes and collections using lazy="true", that is now the default. Existing applications will need to explicitly specify lazy="false" on all non-lazy class and collection mappings. The outer-join attribute is deprecated. Use fetch="join" and fetch="select" instead ...