mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-08 20:24:46 +00:00
Checking for property initialization was acceptable and pretty much the only way to perform assertions before we fixed HHH-14620, but now that initializing a property doesn't imply initializing the collection, it's just plain wrong: * If you expect the collection *not* to be initialized, then checking that that the property is not initialized is too strict: the assertion could fail because the property is initialized while the collection is not initialized. * If you expect the collection to be initialized, then checking that that the property is initialized is not enough: the assertion could pass because the property is initialized while the collection is not initialized. Besides, we can safely call the getter to test the collection directly with Hibernate.isInitialized(entity.getCollection()) since a call to the getter is not supposed to trigger collection initialization.