|
Interestingly that is not the behavior I see..
I took org.hibernate.test.bytecode.enhancement.lazy.LazyCollectionLoadingTestTask, a test Luis Barreiro wrote, and mutated it to do what you suggest. So specifically it:
-
accesses a lazy collection - the collection is fetched
-
accesses a basic attribute - all the non-collection state is fetched, and the basic attributes real value is returned.
So that would seem to contradict what you say happens. So either you are mistaken or your environment does something different. So we are going to need a test illustrating your problem there (preferably built using the org.hibernate.test.bytecode.enhancement.EnhancerTest infrastructure).
Now I did discover something interesting as part of this exercise.. namely collections are still handled differently. So basically all the non-collection lazy state makes up the entities lazy fetch group; when one of these is accessed, they are all fetched. Collections are handled separately.
|