[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3808) Manual fetching of associations

Shawn Clowater (JIRA) noreply at atlassian.com
Thu Mar 19 14:04:40 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32680#action_32680 ] 

Shawn Clowater commented on HHH-3808:
-------------------------------------

I'm not ignoring you, I was in vegas for a few days over the weekend and I'm still catching up at work.

To be honest, I'm still not 100% if we're still talking about the same thing.  In my case all I really want is something in the API that I can define the complete list of properties I want loaded from a root entity w/o changing it's actual fetch mode.  i.e. if I have select or subselect coupled with a lazy mapping, I simply want something where I can say fetch the following list of properties when you're hydrating the objects passed in as dot notation strings, i.e. a.b.c, a.d.e, f, etc.  Right now we've got a layer on top of our main fetch where we go out and call Hibernate.initialize() on the entities and walk the various chains.  

I'm not sure if there would be any difference in the performance aspect of it but it would push the functionality into the core.  I think anyone using detached entities probably has some sort of layer written to ensure anything they need is loaded by hibernate before the session is closed.

in your case, I am unclear when the 'fetch' is executed.  If you're in the same session all you need to do is call Hibernate.initalize() on the collection you're dealing with and it will load the bids for whatever item you're dealing with.  If you're outside of the initial session then you start to get into dicey territory with different instances representing the same entity, etc.

> Manual fetching of associations
> -------------------------------
>
>                 Key: HHH-3808
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3808
>             Project: Hibernate Core
>          Issue Type: New Feature
>          Components: core
>            Reporter: Ovidio Mallo
>
> In performance critical parts of an application, batch fetching and subselect fetching not always allow for an efficient and specific prefetching of entity associations. Therefore, I wanted to propose to add some API which allows to prefetch a given association for a user defined set of entities. This could be something like
>     Session#fetch(Class ownerClass, Serializable[] ownerIds, String propertyName)
> or
>     Session#fetch(Class ownerClass, Object[] owners, String propertyName)
> or something similar. The method would then load the association for the given entities (just like batch fetching would do) and put the associations in the session cache for later usage.
> I think this would greatly help when performance really matters and you want to have full control about the set of entities on which an association is fetched.

-- 
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