[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5328) Equality check on a natural-id that references other entities

Manuel Schrag (JIRA) noreply at atlassian.com
Tue Jun 22 05:52:21 EDT 2010


Equality check on a natural-id that references other entities
-------------------------------------------------------------

                 Key: HHH-5328
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5328
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.1
            Reporter: Manuel Schrag


I have the following entity mapping:
{code:xml}
<class name="ch.ims.cufa.data.model.SystemSettingImpl" table="TB_SystemSetting"> 
    <id name="id" type="string" column="id" length="32"> 
      <generator class="uuid.hex"/> 
    </id>  
    <natural-id mutable="true"> 
      <many-to-one name="orgCanton" class="ch.ims.cufa.data.model.OrgCantonImpl" cascade="none" lazy="false" foreign-key="FK_A_OrgCanto_SysSetti" unique="true"> 
        <column name="COL_orgCanton" not-null="true">
        </column> 
      </many-to-one> 
    </natural-id>
  </class> 
</hibernate-mapping>
{code}

Updating fails because hibernate invokes the equals() method on OrgCantonImpl but as the parameter it sends the id of the Object to compare, which returns always false. This ends up in an exception: immutable natural identifier was modified...

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