[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3894) Loader.initializeEntitiesAndCollections() does not guarantee correct behavior of Lifecycle.onLoad()
Michael Papadopoulos (JIRA)
noreply at atlassian.com
Tue May 5 10:18:17 EDT 2009
Loader.initializeEntitiesAndCollections() does not guarantee correct behavior of Lifecycle.onLoad()
---------------------------------------------------------------------------------------------------
Key: HHH-3894
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3894
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Reporter: Michael Papadopoulos
Consider lines 871-879 of org.hibernate.loader.Loader (method initializeEntitiesAndCollections()) :
if ( hydratedObjects!=null ) {
int hydratedObjectsSize = hydratedObjects.size();
if ( log.isTraceEnabled() ) {
log.trace( "total objects hydrated: " + hydratedObjectsSize );
}
for ( int i = 0; i < hydratedObjectsSize; i++ ) {
TwoPhaseLoad.initializeEntity( hydratedObjects.get(i), readOnly, session, pre, post );
}
}
It is possible that hydratedObjects.get(1) is an entity contained in hydratedObjects.get(0). If hydratedObjects.get(0) implements org.hibernate.classic.Lifecycle, its onLoad() method will be called before the contained entity hydratedObjects.get(1) is initialized, thus breaking the contract of onLoad() (i.e. that onLoad() is called after the entity is loaded; in our case hydratedObjects.get(0) will not be fully loaded yet, since one of its properties will not have been initialized yet).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list