[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2879) add an actual api for loading an entity by natural candidate key (mapped natural-id)

Eric Dalquist (JIRA) noreply at atlassian.com
Tue Sep 27 14:36:37 EDT 2011


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

Eric Dalquist commented on HHH-2879:
------------------------------------

Has there been any effort on this feature? I'd love to make better use of NaturalId queries but have a few roadblocks. The biggest being HHH-4838 since most of our queries are loading several objects and so even using the Criteria API we don't get the natural id benefits. Having an explicit way to do natural id queries.

The other thought I had was wondering if it would be possible to tweak the Loader, QueryParameters and a few other related classes to allow them to automatically determine if a query from any source can be treated as a naturalid query. Considering the restrictions already in place by CriteriaImpl.isLookupByNaturalKey I'm hoping it wouldn't be too difficult.

I'd be more than happy to work on a feature patch if there is interest in applying in.

> add an actual api for loading an entity by natural candidate key (mapped natural-id)
> ------------------------------------------------------------------------------------
>
>                 Key: HHH-2879
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2879
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: core
>            Reporter: Steve Ebersole
>            Assignee: Steve Ebersole
>             Fix For: 3.x
>
>
> Currently, natural-id "loading' is only available through some incomplete criteria query hackery.  Would like to expose a proper API for performing natural-id loading. 
> Eventually would be great to have this coordinated with the effort to cleanup the Session API and so have a unified way to load entities.  (NOTE : the contract name I am using for the time being is EntityLoadAccess, although i am not tied to this). - see HHH-2896
> Something like:
> Session.getNaturalKeyEntityLoadAccess( MyEntity.class ).get( key )

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list