title: ActiveMQ: how to set DB lock transaction isolation type properly?
body: <p>In my ActiveMQ configuration I would like to change the default DB lock transaction isolation level to <code>TRANSACTION_REPEATABLE_READ</code>.</p>
  
  <p><a href="http://activemq.apache.org/maven/apidocs/org/apache/activemq/store/jdbc/JDBCPersistenceAdapter.html#setTransactionIsolation%28int%29" rel="nofollow">API documentation</a> writes:</p>
  
  <blockquote>
    <p><code>public void setTransactionIsolation(int transactionIsolation)</code> </p>
    
    <p>set the Transaction isolation level to something other that
    <code>TRANSACTION_READ_UNCOMMITTED</code> This allowable dirty isolation level may
    not be achievable in clustered DB environments so a more restrictive
    and expensive option may be needed like <code>TRANSACTION_REPEATABLE_READ</code>
    see isolation level constants in <a href="http://download.oracle.com/javase/6/docs/api/java/sql/Connection.html?is-external=true" rel="nofollow"><code>Connection</code></a></p>
  </blockquote>
  
  <p>In the XML configuration, the <code>jdbcPersistenceAdapter</code>'s <code>transactionIsolation</code> attribute accepts only integer-type values, so I cannot use the <a href="http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#TRANSACTION_REPEATABLE_READ" rel="nofollow"><code>Connection.TRANSACTION_REPEATABLE_READ</code></a> constant directly, but only it's <a href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/sql/Connection.java#Connection.0TRANSACTION_REPEATABLE_READ" rel="nofollow">value (4)</a> instead:</p>
  
  <pre><code>&lt;persistenceAdapter&gt;
      &lt;jdbcPersistenceAdapter dataDirectory="${activemq.data}" dataSource="#mysql-ds" transactionIsolation="4" lockKeepAlivePeriod="5000"&gt;
          &lt;locker&gt;
              &lt;lease-database-locker lockAcquireSleepInterval="10000"/&gt;
          &lt;/locker&gt;
      &lt;/jdbcPersistenceAdapter&gt;
  &lt;/persistenceAdapter&gt;
  </code></pre>
  
  <p>Is there a way, that I could specify the constant instead of hardcoding number "4"?</p>
  
  <p>As ActiveMQ is Spring-based, I thought I could try to assign it somehow via using <a href="http://docs.spring.io/spring/docs/3.2.4.RELEASE/spring-framework-reference/html/xsd-config.html#xsd-config-body-schemas-util-constant" rel="nofollow">&lt;util:constant&gt;</a>, but could not find how to do it...</p>