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

    one-to-one mapping with Primary key association

    Amar Singh Newbie

      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"/>
       <one-to-one name="fp" class="FP" cascade="all" />
      <class name="FP" table="F_P">
       <id name="id" type="long" column="F_P_ID">
       <generator class="foreign">
       <param name="property">parent</param>
       <one-to-one name="parent" class="FUI" cascade="save-update" constrained="true" />

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