Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1270

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XDT-1270
    Summary: ValueObject generates bad hashCode() method
       Type: Bug

     Status: Open
   Priority: Major

 Original Estimate: 15 minutes
 Time Spent: Unknown
  Remaining: 15 minutes

    Project: XDoclet
 Components: 
             EJB Module
   Versions:
             1.2.2

   Assignee: xdoclet-devel (Use for new issues)
   Reporter: timo raty

    Created: Mon, 14 Feb 2005 4:51 AM
    Updated: Mon, 14 Feb 2005 4:51 AM
Environment: SuSE Linux 9.1, JDK 1.5, Eclipse, XDoclets 1.2.2

Description:
When generating value object code for a CMP bean that has aggregate
objects through a relation. The template for Value Object method 
hashCode() calls methods for obtaining the aggregate fields. Called
method returns an array (through use of toArray()) and calculating
hashCode from this array results in different hash code value every
time the calculation is performed.

I checked this agains version 1.24 of valueobject.xdt and the problem
is there too.

Fix is to modify the valueobject.xdt template to generate code that
calculates the hash code value directly by using the <field>, i.e. not
by calling the get<field>() method. This way no temporary array
is created and the hash code is same every time - unless the object
has really been modified. In the original template code there is code
generation for "get" and "()" in place of "XXX" below - removing these
fixes hash:

result = 37*result + ((this.XXX<XDtEjbValueObj:currentAggregateName/>sXX != 
null) ? this.XXX<XDtEjbValueObj:currentAggregateName/>sXXX.hashCode() : 0);




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



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
xdoclet-devel mailing list
xdoclet-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to