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

Gail Badner (JIRA) noreply at atlassian.com
Sun Jul 11 20:03:13 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner resolved HHH-5328.
------------------------------

      Assignee: Gail Badner
    Resolution: Duplicate

This was fixed in 3.5.2.

> 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
>            Assignee: Gail Badner
>
> 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