4 Replies Latest reply on Apr 14, 2009 3:24 AM by adamw

    one-to-one mapping with Primary key association

    amarsingh

      one-to-one mapping with primary key association doesn't seem to be working. Eg.

      <class name="FUI" table="F_U_I" >
       <id name="longId" type="long" column="F_I_ID">
       <generator class="native"/>
       </id>
       <one-to-one name="fp" class="FP" cascade="all" />
      </class>
      
      <class name="FP" table="F_P">
       <id name="id" type="long" column="F_P_ID">
       <generator class="foreign">
       <param name="property">parent</param>
       </generator>
       </id>
       <one-to-one name="parent" class="FUI" cascade="save-update" constrained="true" />
      </class>
      


      When we try to load a FUI, the underlying query invokes RelatedAuditExpression and since its not a foreign-key based one-to-one association the loading fails in method addToQuery of RelatedAuditExpression at line 52 (relatedEntity==null) with the following exception:
      "This criterion can only be used on a property that is a relation to another property."