[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3414) fetch profiles

Steve Ebersole (JIRA) noreply at atlassian.com
Thu Oct 22 16:54:28 EDT 2009


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

Steve Ebersole commented on HHH-3414:
-------------------------------------

@savio : yet to be determined long term.  as of now it follows the same rules as metadata fetching: HQL ignores while criteria honors.  I'd much prefer any changes to be symmetric.

@Paul : yes, but this is exactly why it is recommended that you map associations as lazy and use various use-case based fetching (previously hql/criteria fetches, but now these fetch profiles too).  Making something you mapped as non-lazy suddenly lazy for a particular use-case is not coming back.  And yes, fetch profiles are enabled on the Session.  That's the idea.

@Darren : see above.

> fetch profiles
> --------------
>
>                 Key: HHH-3414
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3414
>             Project: Hibernate Core
>          Issue Type: New Feature
>          Components: core, metamodel
>            Reporter: Steve Ebersole
>            Assignee: Steve Ebersole
>             Fix For: 3.7
>
>
> The concept of fetch profiles as we are discussing here is basically to allow users to dynamically affect the mapped fetching strategy for associations at runtime.
> Consider the following example:
> <class name="Person">
>     ...
>     <set name="addresses" lazy="true" fetch="subselect" ...>
>         ...
>     </set>
> </class>
> <class name="Address">
>     ...
> </class>
> This follows the normal recommendation to map associations as lazy and use a dynamic fetching strategy (ala HQL/Criteria) to modify this lazy behavior at runtime.
> The fetaure discussed here would allow the same behavior for loading as well:
> <hibernate-mapping>
>     <fetch-profile name="person-details">
>         <fetch path="Person.addresses" style="join"/>
>     </fetch-profile>
> </hibernate-mapping>
> Or:
> <hibernate-mapping>
> <class name="Person">
>     ...
>     <fetch-profile name="person-details">
>         <fetch path="addresses" style="join"/>
>     </fetch-profile>
>     <set name="addresses" lazy="true" fetch="subselect" ...>
>         ...
>     </set>
> </class>
> </hibernate-mapping>
> Now, doing:
> session.enableFetchProfile( "person-details" ).get( Person.class, 1 )...
> will load Person#1 as well as their addresses in a single joined query.

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