私はこのクラス Person を2つのテーブルにマッピングしています: Persons と PersonsAUD (監査):
<class catalog="test" name="test.Person" table="Persons" entity-name="Person">
<id name="id" type="int">
<column name="Id"/>
<generator class="increment"/>
</id>
<property name="name" type="string">
<column length="30" name="Name" not-null="true"/>
</property>
...
</class>
<class catalog="test" name="test.Person" table="PersonsAUD" entity-name="PersonAUD">
<id name="idAudit" type="int">
<column name="IdAudit"/>
<generator class="increment"/>
</id>
<property name="name" type="string">
<column length="30" name="Name" not-null="true"/>
</property>
<property name="action" type="string">
<column length="10" name="Action" not-null="true"/>
</property>
...
</class>
このオブジェクトを次のように 2 つのテーブルに保存しようとしています。
session.save("Person", person);
session.save("PersonAUD", person);
ただし、監査行ではなく、最初の行のみが挿入されます。おそらく休止状態で人の状態をチェックし、すでに保存されていることを確認します。
休止状態に強制的に両方のテーブルに同じオブジェクトを保存させる機会はありますか?
前もって感謝します。