[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3808) Manual fetching of associations
Ovidio Mallo (JIRA)
noreply at atlassian.com
Sat Mar 21 09:09:38 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32690#action_32690 ]
Ovidio Mallo commented on HHH-3808:
-----------------------------------
Thanks for the feedbak, Shawn!
It seems like we are really talking about different things. I like what you're suggesting and I think it would be nice if Hibernate had explicit support for that use case.
What I want to do is loading the Bids collections for a given set of Items which I want to do in a single bulk load operation and I want Hibernate to load the Bids collections for exactly those Items (I already have the Items loaded by some other means). The problem with using Hibernate.initialize() or simply accessing the Bids collections is that Hibernate decides behind the scenes during lazy-loading on which Items the Bids collections are loaded, depending on whether you have configured batch fetching or subselect fetching in your global mapping file. While this is often fine, it doesn't always give you full control on the set of Items on which the Bids collections are loaded. With batch fetching you have the problem that the Bids may be loaded on too many Items and subselect fetching only performs ideally if you have loaded the Items on which you want to have the Bids loaded in the same query. IMHO, in more complex applications such global fetching strategies do not always perform ideally, especially in performance critical parts.
So, in essence, what I want to do is simply to batch load the Bids collections (or other properties) on a user-defined set of Items.
> 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