[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-1116) Generated hashCode() is inconsistent with equals() when using natural-id tag
Magnus Jungsbluth (JIRA)
noreply at atlassian.com
Fri Apr 3 04:51:39 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-1116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32780#action_32780 ]
Magnus Jungsbluth commented on HBX-1116:
----------------------------------------
after the patch generated hashCode() looks like:
public int hashCode() {
int result = 17;
result = 37 * result + ( getIdentificationNo() == null ? 0 : this.getIdentificationNo().hashCode() );
return result;
}
> 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