[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2309?page=c...
]
nikita tovstoles commented on HHH-2309:
---------------------------------------
Patch Submission
Attached HHH-2309-nikitaAtDoppelgangerDotCom-version1.patch fixes this issue for the case
when all lazy properties are one-to-one's on a shared PK. in this case
AbstractEntityPersister.initializeLazyProperty:
-no longer needlessly goes to the 2nd level cache
-initializes requested property only
-Fully passes Hibernate Core testsuite
This patch is based on Hibernate Core 3.3.1.GA and should be applied from within the
parent directory of 'core' and 'testsuite' dirs.
What about the general case?
I think the only thing(s) left to do to enable un-batched lazy property initialization for
cases other than one-to-one on a shared PK are:
- generate appropriate sql lazySelectString given property being requested (in
AEP.initializeLazyPropertiesFromDatastore)
- possibly alter CacheEntry to enumerate uninitialized properties (rather than simply
store a boolean value)
That's it
Impl Notes
-bulk of work invloved replacing calls to
AbstractEntityPersister.hasUninitializedLazyProperties() with ones to a new
AbstractEntityPersister.getUninitializedLazyPropertyNames()
-generates appropriate SQL in AbstractEntityPersister.update (see comments around line
2655)
-made an assumption that StandardPropertyName.getName() returns the same string as in
AbstractFieldInterceptor.uninitializedFields (i.e. fieldName == property name). This
assumption seems safe because it's already been made in
PojoEntityTuplizer.afterInitialize() where lazyProps are being passed in for
FieldInterceptionHelper.injectFieldInterceptor(..,..,uninitializedFieldNames)
-left AbstractEntityPersister.generateLazySelectString() unchanged, and so
AEP.initializeLazyPropertiesFromDatastore() will execute the same sql as before when
lazySelect != null. (that is when lazy props include columns other than shared PKs)
Implications: initializeLazyPropertiesFromDatastore will be called every time as long as
hasUninitializedLazyProperties will keep returning true
fetch only the lazy property needed
------------------------------------
Key: HHH-2309
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2309
Project: Hibernate Core
Issue Type: New Feature
Components: core
Affects Versions: 3.2.1
Reporter: German de la Cruz
Attachments: HHH-2309-nikitaAtDoppelgangerDotCom-version1.patch
The method AbstractEntityPersister.initializeLazyProperty(..) load all lazy properties
when it's called. It would be great if could only load the requested property.
I think the only change we need is in
AbstractEntityPersister.initializeLazyPropertiesFromDatastore(...) and
AbstractEntityPersister.initializeLazyPropertiesFromCache(...). We must change them in a
way that only the referenced property is loaded.
After that, we must change AbstractFieldInterceptor.intercept(..) to update in a better
way the unitializedFields collection (I mean, removing the actual property only instead of
null it).
Besides. Why in line 777 to 780 a query is executed? I think it isn't necessary.
Thanks.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira