[hibernate-dev] persister.afterInitialize() called too early

Guillaume Smet guillaume.smet at gmail.com
Mon Oct 15 06:09:28 EDT 2018


Hi,

On Friday, I started to take a look at
https://hibernate.atlassian.net/browse/HHH-12425.

The current flow of operations is the following:
Loader#initializeEntitiesAndCollections
 \_ TwoPhaseLoad.initializeEntity()
      \_ initialize the entity
      \_ persister.afterInitialize()
 \_ endCollectionLoad of the collection persisters
 \_ TwoPhaseLoad.postLoad()

The issue we have is that afterInitialize() is called before the collection
loading has been done. The collections are not in the persistence context
yet when calling persister.afterInitialize(), which is required with
enhanced entities.

As afterInitialize() is supposed to be called after the properties have
been initialized, I think it makes sense to wait for the collections to be
properly initialized.

I'm wondering if we should isolate the persister.afterInitialize() call
into a TwoPhaseLoad.afterInitialize() method, which would be called after
the collection initialization.

Any thoughts or better ideas?

Thanks.

-- 
Guillaume


More information about the hibernate-dev mailing list