2 Replies Latest reply on Jun 28, 2011 4:06 AM by Nader Mirzadeh

    One-To-Many relation is not audited at insert

    Nader Mirzadeh Newbie

      I've a class with one-to-many relation that Envers doesn't audit correctly at insertion of a new relation.  What I mean by 'not audited correctly' is explained below in a concrete example.


      Hibernate version is 3.5.6.




      public class Lifecycle  {



          private Set<StateTransition> stateTransitions;



      } // end of Lifecycle


      <hibernate-mapping default-access="field">

        <class name=Lifecycle" table="LIFECYCLE">


          <set cascade="all,delete-orphan" fetch="select" inverse="false" lazy="false" name="stateTransitions">

            <cache region="cams-installation" usage="read-write"/>

            <key not-null="true">

              <column name="ID_LIFECYCLE" precision="10" scale="0"/>


            <one-to-many class="com.bellid.cams.model.StateTransition"/>




      When a new StateTransition object is added to the stateTransition-set, the historic StateTransition object has 'null' as the reference to its associated Lifecycle instance. However, whenever an existing StateTransition object gets updated, Envers populates correctly the reference to its associated Lifecyle.


      Is this a bug?, or it is a feature by design!