Two entities that have no identifier cannot be assumed to be equal
------------------------------------------------------------------
Key: HIB-78
URL: http://galaxy.andromda.org:8080/jira/browse/HIB-78
Project: Hibernate Cartridge
Type: Bug
Versions: 3.0RC1
Reporter: Michal Bielecki
Assigned to: Martin West
Two entities that have no identifier cannot be assumed to be equal!!!!!!
Currently the following code will add just one Child: (assuming you have
cascade save)
Parent p1 = new Parent("P1");
Child c1 = new Child("C1");
Child c2 = new Child("C1");
//Both c1 and c2 have no identifier
p1.getChildren().add(c1);
p1.getChildren().add(c2);
//(p1.getChildren().size == 1) is true as c1.equals(c2)
session.save(p1); //only one child saved
In the body of equals method there is:
#else
if (this.$identifier.name == null ? that.$identifier.name != null :
!this.${identifier.name}.equals(that.$identifier.name))
{
return false;
}
#end
#end
return true;
#end
there should be:
#else
if (this.$identifier.name == null || that.$identifier.name == null ||
!this.${identifier.name}.equals(that.$identifier.name))
{
return false;
}
#end
#end
return true;
#end
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://galaxy.andromda.org:8080/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
Andromda-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-devel