[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-1072) hbm2java generates bad code for BigDecimal in equals() (Remains after HBX-426)

Arnaud Renouf (JIRA) noreply at atlassian.com
Wed Aug 13 04:13:07 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_30850 ] 

Arnaud Renouf commented on HBX-1072:
------------------------------------

I tried to put the complete typename in the hbm.xml but the problem was still there :

Here is a part of my campaigndata.hbm.xml : 

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 12/11/2007 10:12:28 by Hibernate Tools 3.2.0.b11 -->
<hibernate-mapping>
  <class name="com.siriade.stats.appli.beans.Campaigndata" table="campaigndata">
    <meta attribute="implement-equals">true</meta>

    <id name="idCampaigndata" type="long">
            <column name="id_campaigndata" />
	    <generator class="sequence">
	      <param name="sequence">
		  campaigndata_id_campaigndata_seq
	      </param>
	    </generator>
    </id>

    <property name="dailyBudget" type="java.math.BigDecimal">
       	<meta attribute="use-in-equals">true</meta>
        <column name="daily_budget" precision="10" />
    </property>

  </class>
</hibernate-mapping>

As soon as I changed the test in BasicPOJOClass.java, everything was ok.

> hbm2java generates bad code for BigDecimal in equals() (Remains after HBX-426)
> ------------------------------------------------------------------------------
>
>                 Key: HBX-1072
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1072
>             Project: Hibernate Tools
>          Issue Type: Bug
>          Components: hbm2java
>    Affects Versions: 3.2.1
>         Environment: Hibernate 3, Postgres
>            Reporter: Arnaud Renouf
>   Original Estimate: 30 minutes
>  Remaining Estimate: 30 minutes
>
> Even with the correction in HBX-426, the bug is still there. In BasicPOJOClass.java in method useCompareTo(String javaTypeName), the javaTypeName is not the complete type name (with packages). So the test "java.math.BigDecimal".equals(javaTypeName) always returns false and the BigDecimal.compareTo method is never used in the generated equals method. 

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