I think there can be an inconsistency between Hibernate#isPropertyInitialized vs Hibernate#isInitialized when it comes to an extra-lazy collection of an enhanced entity.
IIUC, after fixing HHH-11161 [1], if an extra-lazy collection is accessed on an enhanced entity, the collection property is set to an uninitialized PersistentCollection and calling Hibernate#isPropertyInitialized( collectionfieldName ) will return true, even though the collection itself is uninitialized. I would have expected that false would be returned. I've added a comment to the issue and asked Luis about it. Luis has pointed out the 3 stages of an extra-lazy collection on an enhanced entity. I've listed them below and added my understanding of what Hibernate#initialize and Hibernate#isPropertyInitialized will return in each instance: 1) the attribute is not loaded at all; Hibernate.isPropertyInitialized( enhancedEntity, "extraLazyCollection" ) returns false; Hibernate.initialize( enhancedEntity.getExtraLazyCollection() ) returns false; a side-affect is that the attribute will be set to an uninitialized PersistentCollection. 2) the attribute is loaded, but the elements are not loaded; Hibernate.isPropertyInitialized( enhancedEntity, "extraLazyCollection" ) returns true, because the property is initialized to a PersistentCollection (even though the PersistentCollection itself is uninitialized). Hibernate.initialize( enhancedEntity.getExtraLazyCollection() ) returns false. 3) the attribute is loaded and the elements are loaded. Hibernate.isPropertyInitialized( enhancedEntity, "extraLazyCollection" ) returns true. Hibernate.initialize( enhancedEntity.getExtraLazyCollection() ) returns true. Opinions about the inconsistency in 2)? Is this a bug in the code or in the Javadoc? Thanks, Gail [1] https://hibernate.atlassian.net/browse/HHH-11161 _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev