title: Hibernate 4: One class mapping Two tables - How to persist one object on both tables?
body: <p>I have this class Person mapping two tables: Persons and PersonsAUD (audit):</p>
  
  <pre><code> &lt;class catalog="test" name="test.Person" table="Persons" entity-name="Person"&gt;
      &lt;id name="id" type="int"&gt;
        &lt;column name="Id"/&gt;
        &lt;generator class="increment"/&gt;
      &lt;/id&gt;
      &lt;property name="name" type="string"&gt;
        &lt;column length="30" name="Name" not-null="true"/&gt;
      &lt;/property&gt;
      ...    
  
    &lt;/class&gt;
  
    &lt;class catalog="test" name="test.Person" table="PersonsAUD" entity-name="PersonAUD"&gt;
  
      &lt;id name="idAudit" type="int"&gt;
        &lt;column name="IdAudit"/&gt;
        &lt;generator class="increment"/&gt;
      &lt;/id&gt;      
  
      &lt;property name="name" type="string"&gt;
        &lt;column length="30" name="Name" not-null="true"/&gt;
      &lt;/property&gt;
      &lt;property name="action" type="string"&gt;
        &lt;column length="10" name="Action" not-null="true"/&gt;
      &lt;/property&gt;
      ...
    &lt;/class&gt;
  </code></pre>
  
  <p>I'm trying to save this object in the two tables like this:</p>
  
  <pre><code>session.save("Person", person);
  session.save("PersonAUD", person);
  </code></pre>
  
  <p>But only the first row is inserted, not the audit row; probably hibernate check the person's state and confirms that is already saved.</p>
  
  <p>Any chance to force hibernate to save in both tables the same object?</p>
  
  <p>Thanks in advance.</p>