[hibernate-dev] EntityPersister.initializeLazyProperty: ask for one, initialize all?

Nikita Tovstoles nikita at doppelganger.com
Fri May 22 15:11:35 EDT 2009


Our app fails to scale sufficiently and I'd traced our problems to eager loading of all OneToOne relations when any single one is accessed. I would like to fix that but wanted to get feedback first. I'm referring to Hibernate Core 3.3.1.GA below:

Currently in AbstractFieldInterceptor.intercept():
"uninitializedFields = null; //let's assume that there is only one lazy fetch group, for now!"

proposed fix: 
-after 'result' is returned call uninitializedFields.remove(fieldname). Question: should this only be done if result != null?

And then AbstractEntityPersister.initializeLazyProperties() calls methods that initialize *all* properties even though a specific fieldname is supplied:
* initializeLazyPropertiesFromDatastore or
* initializeLazyPropertiesFromCache

Proposed fix:
-In both cases, determine appropriate 'j' value by searching lazyPropertyNames for 'fieldName'
-only call nullSafeGet, and initializeLazyProperty( fieldName, entity, session, snapshot, j, propValue ) once.


What do folks think?

Thanks,
-nikita





More information about the hibernate-dev mailing list