[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-1116) Generated hashCode() is inconsistent with equals() when using natural-id tag

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Thu Apr 2 14:46:38 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-1116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32775#action_32775 ] 

Max Rydahl Andersen commented on HBX-1116:
------------------------------------------

This looks good - any chance you got a testcase to show what it fixes ?

> Generated hashCode() is inconsistent with equals() when using natural-id tag
> ----------------------------------------------------------------------------
>
>                 Key: HBX-1116
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1116
>             Project: Hibernate Tools
>          Issue Type: Patch
>    Affects Versions: 3.2.4.GA
>         Environment: hibernate tools revision 16240
>            Reporter: Magnus Jungsbluth
>            Priority: Minor
>         Attachments: hbm2java_hashCode_equals.patch
>
>
> when using a natural-id tag in a hbm.xml file, the pojo's generated equals method uses the natural-id properties while the hashcode implementation requires an additional meta-attribute
> the included patch uses the same check as in the equals generation in basicpojoclass.java
> additionally the template has been changed to only iterate over equalshashcode properties which reduces unnecessary blank lines in the hashcode implementation
> the template also contained wrongly indented lines

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