[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2896) unified approach for id and natural-id loading
Steve Ebersole (JIRA)
noreply at atlassian.com
Tue Sep 27 18:21:38 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43747#comment-43747 ]
Steve Ebersole commented on HHH-2896:
-------------------------------------
Initial design swag...
First add 2 new interfaces:
{code}
/**
* Specifically access by id
*/
public interface IdentifierLoadAccess<T> {
public IdentifierLoadAccess<T> with(LockOptions lockOptions);
public T getReference(Object id);
public T load(Object id);
}
/**
* Specifically access by natural-key
*/
public interface NaturalIdLoadAccess<T> {
public NaturalIdLoadAccessT<T> with(LockOptions lockOptions);
public NaturalIdLoadAccess<T> using(String attributeName, Object value);
public T getReference();
public T load();
}
{code}
Eventually, add a method to the above {{NaturalIdLoadAccess}} interface to allow "static type-safe" means for defining values (ala jpa criteria query).
And then add some new methods to {{Session}}:
{code}
public IdentifierLoadAccess byId(String entityName);
public <T> IdentifierLoadAccess<T> byId(Class<T> entityClass);
public NaturalIdLoadAccess byNaturalKey(String entityName);
public <T> NaturalIdLoadAccess<T> byNaturalKey(Class<T> entityClass);
{code}
> unified approach for id and natural-id loading
> -----------------------------------------------
>
> Key: HHH-2896
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2896
> Project: Hibernate Core
> Issue Type: Improvement
> Components: core
> Reporter: Steve Ebersole
> Assignee: Steve Ebersole
> Fix For: 3.x
>
> Attachments: hhh-2896_irc_discussion.txt
>
>
> A follow-on to HHH-2879 in regards to unifying the loading of entities by pk or natural-id.
--
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