Message: A new issue has been created in JIRA.
--------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1048 Here is an overview of the issue: --------------------------------------------------------------------- Key: XDT-1048 Summary: updateXYValue: wrong results Type: Bug Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: XDoclet Versions: 1.2 Assignee: xdoclet-devel (Use for new issues) Reporter: Marcus Beyer Created: Tue, 31 Aug 2004 3:33 AM Updated: Tue, 31 Aug 2004 3:33 AM Description: Lets say I have an existing value object myPersonValue and create a new value object myCarValue = new CarValue() and do myPersonValue.addCarValue(myCarValue). (composite relation) Then (not yet persisted, still the same objects) the user decides to change the color of myCarValue(), e.g. myCarValue.setColor("white"). So I do myPersonValue.updateCarValue(myCarValue). Bang! myPersonValue.updateCarValue(myCarValue) adds myCarValue to myPersonValue.updatedCarValues, what it shouldn't. Trying to persist this, findByPrimaryKey is called with a null agument, etc. So why does it do so? myPersonValue.updateCarValue(myCarValue) tests if myPersonValue.addedCarValues.contains(myCarValue). This returns *false*! Why? Because addedCarValues is a HashSet and the hash value of myCarValue has changed because of the color change. Workaround: Before update, first test if PK is not null. Solution: I propose to let the hash value of a value object only be dependend on its primary key (PK). If PK if null, hash value should be always the same (e.g. -1), so that identity/equality decides in a HashSet. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/xdoclet/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 BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
