[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6541) ColumnValues.applyColumnValues tests presence of uniqueValue but reads nameValue

Tom Coogan (JIRA) noreply at atlassian.com
Thu Dec 29 10:42:19 EST 2011


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

Tom Coogan commented on HHH-6541:
---------------------------------

This bug is still present in Hibernate Core 4.0.0.Final.  It should be an extremely simple fix.

> ColumnValues.applyColumnValues tests presence of uniqueValue but reads nameValue
> --------------------------------------------------------------------------------
>
>                 Key: HHH-6541
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6541
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations
>    Affects Versions: 4.0.0.Beta4
>         Environment: 4.0.0.Beta4, postgresql 9
>            Reporter: Erik Bertelsen
>
> In https://github.com/hibernate/hibernate-core/blob/master/hibernate-core/src/main/java/org/hibernate/metamodel/source/annotations/attribute/ColumnValues.java in the method applyColumnValues, the following lines are present:
> AnnotationValue nameValue = columnAnnotation.value( "name" );
> if ( nameValue != null ) {
> this.name = nameValue.asString();
> }
> AnnotationValue uniqueValue = columnAnnotation.value( "unique" );
> if ( uniqueValue != null ) {
> this.unique = nameValue.asBoolean();
> }
> Note that this.unique is set from nameValue.asBoolean instead of the intended uniqueValue.asBoolean. This causes an IlleArgumentException (unless nameValue happens to be a valid boolean value). Only uniqueValue seems to be affected, the remaining properties look ok.
> Suggested fix:
> replace 'this.unique = nameValue.asBoolean();' by 'this.unique = uniqueValue.asBoolean();'
> Consequence of this bug: It is not possible to annotate a property of an entity class by:
>     @Column(name = "someName", unique = true)

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