title: Why does Hibernate throw org.hibernate.exception.LockAcquisitionException?
body: <p>I have this method :</p>
  
  <pre><code>mymethod(long id){  
      Person p = DAO.findPerson(id);
  
      Car car = new Car();
      car.setPerson(p);
      p.getCars().add(car);
  
      DAO.saveOrUpdate(car);
      DAO.saveOrUpdate(p);
      DAO.delete(p.getCars().get(0));//A person have many cars
  }  
  </code></pre>
  
  <p>Mapping : </p>
  
  <p>Person.hbm.xml</p>
  
  <pre><code>&lt;!-- one-to-many : [1,1]-&gt; [0,n] --&gt;
  &lt;set name="car" table="cars" lazy="true" inverse="true"&gt;
      &lt;key column="id_doc" /&gt;
      &lt;one-to-many class="Car" /&gt;
  &lt;/set&gt;
  
  &lt;many-to-one name="officialCar"
  class="Car" 
  column="officialcar_id" lazy="false"/&gt;  
  </code></pre>
  
  <p>Cars.hbm.xml</p>
  
  <pre><code>&lt;many-to-one name="person" class="Person"
              column="id_person" not-null="true" lazy="false"/&gt;   
  </code></pre>
  
  <p>This method works well for a single thread, and on multiple threads, gives me an error: </p>
  
  <pre><code>02/08/2014 - 5:19:11 p.m. - [pool-1-thread-35] - WARN - org.hibernate.util.JDBCExceptionReporter - SQL Error: 60, SQLState: 61000 
  02/08/2014 - 5:19:11 p.m. - [pool-1-thread-35] - ERROR - org.hibernate.util.JDBCExceptionReporter - ORA-00060: deadlock detection while waiting for a resource 
   
  02/08/2014 - 5:19:11 p.m. - [pool-1-thread-35] - WARN - org.hibernate.util.JDBCExceptionReporter - SQL Error: 60, SQLState: 61000 
  02/08/2014 - 5:19:11 p.m. - [pool-1-thread-35] - ERROR - org.hibernate.util.JDBCExceptionReporter - ORA-00060: deadlock detection while waiting for a resource 
   
  02/08/2014 - 5:19:11 p.m. - [pool-1-thread-35] - ERROR - org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session 
  org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update
  </code></pre>
  
  <p>AOP Transaction :</p>
  
  <pre><code>&lt;tx:advice id="txAdviceNomService" transaction-manager="txManager"&gt;
      &lt;tx:attributes&gt;
          &lt;tx:method name="*" propagation="REQUIRED" rollback-for="java.lang.Exception" /&gt;
          &lt;tx:method name="getAll*" read-only="true" propagation="SUPPORTS" /&gt;
          &lt;tx:method name="find*" read-only="true" propagation="SUPPORTS" /&gt;
      &lt;/tx:attributes&gt;
  &lt;/tx:advice&gt;
  </code></pre>
  
  <p><strong>NB : When i add Thread.sleep(5000) after update, it is ok. But this solution is not clean.</strong> </p>