[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-122) Add natural-id annotation

Emmanuel Bernard (JIRA) noreply at atlassian.com
Wed May 23 20:49:04 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27042 ] 

Emmanuel Bernard commented on ANN-122:
--------------------------------------

@Index can be defined at the class level @o.h.a.Table(indexes=) and contain an ordered array of columns. So proper column ordering can be ensured.

We actually can do the same for @NaturalId
use a random order if @NaturalId is set to properties
use a specific property if @NaturalId(properties={}) is defined at the class level

Ah, I tend to no longer pass arguments like isNatural and isMutable. Instead I read the annotation when I need it. The code becomes much more maintainable. Following this strategy will solve your Boolean problem. Basically mutability will look like something like that

isMutable(XProperty property) {
  NaturalId naturalIdAnn = property.getAnnotation(NaturalId.class);
  return naturalIdAnn == null || naturalId.mutable();
}

> Add natural-id annotation
> -------------------------
>
>                 Key: ANN-122
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-122
>             Project: Hibernate Annotations
>          Issue Type: New Feature
>          Components: binder
>    Affects Versions: 3.1beta6
>            Reporter: Mathias Bogaert
>            Priority: Minor
>             Fix For: 3.3.1
>
>         Attachments: natural-id-v2.patch, natural-id.patch
>
>
> HIbernate 3.0.5 introduced natural-id. Add this to Annotations, as a @NaturalId annotation.

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