title: Hibernate lock wait problem
body: <p>We have a Java application that listens sockects and records the parsed information to MySql database. We are using hibernate as ORM layer. Whole persistance process is handled by a dedicated thread . Entities are inserted and updated in groups of 20, maximum insert rate is 30 inserts/sec and maximum update rate is 30 updates/sec on a 6-core 24GB-RAM linux box. DB size is around 16GB at the moment. Application hangs after running smoothly for 40 minutes with the exception below :
      <code>org.hibernate.util.JDBCExceptionReporter - SQL Error: 1205, SQLState: 41000
      Lock wait timeout exceeded; try restarting transaction
  javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute update query</code></p>
  
  <p>Even if there exists a lock on the row this thread must never stop and if possible forcibly release the lock on the row, how can I guarentee this behaviour? Any help will be appreciated. Below you may find our hibernate configuration:</p>
  
  <pre><code>&lt;properties&gt;
    &lt;property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/&gt;
    &lt;property name="hibernate.connection.url" value="jdbc:mysql://**************:3306/*********?useUnicode=yes;characterEncoding=UTF-8;rewriteBatchedStatements=true;includeThreadNamesAsStatementComment=true"/&gt;
    &lt;property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/&gt;
    &lt;property name="hibernate.connection.autocommit" value="false"/&gt;
    &lt;property name="hibernate.connection.useUnicode" value="true"/&gt;
    &lt;property name="hibernate.connection.characterEncoding" value="UTF-8"/&gt;
    &lt;property name="hibernate.connection.show_sql" value="true"/&gt;
    &lt;property name="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider"/&gt;
    &lt;property name="hibernate.connection.zeroDateTimeBehavior" value="convertToNull"/&gt;
    &lt;property name="hibernate.c3p0.max_size" value="100"/&gt;
    &lt;property name="hibernate.c3p0.min_size" value="0"/&gt;
    &lt;property name="hibernate.c3p0.acquire_increment" value="1"/&gt;
    &lt;property name="hibernate.c3p0.idle_test_period" value="300"/&gt;
    &lt;property name="hibernate.c3p0.max_statements" value="0"/&gt;
    &lt;property name="hibernate.c3p0.timeout" value="100"/&gt;
    &lt;property name="hibernate.c3p0.autoCommitOnClose" value="false"/&gt;
    &lt;!-- JDBC connection pool (use the built-in) --&gt;
    &lt;!--Hibernate Batch Process Best Practices --&gt;
    &lt;property name="hibernate.order_updates" value="true"/&gt;
    &lt;property name="hibernate.order_inserts" value="true"/&gt;
    &lt;property name="hibernate.jdbc.batch_size" value="15" /&gt;
  &lt;/properties&gt;
  </code></pre>