title: Cannot change transaction read-only property in the middle of a transaction
body: <p>I am using BoneCP with Postgresql and Spring JdbcTemplate. When JdbcTemplate executes query and then tries to close the connection, it gets this exception:</p>
  
  <blockquote>
    <p>org.postgresql.util.PSQLException: Cannot change transaction read-only
    property in the middle of a transaction. at
    org.postgresql.jdbc2.AbstractJdbc2Connection.setReadOnly(AbstractJdbc2Connection.java:725)
    at
    com.jolbox.bonecp.ConnectionHandle.setReadOnly(ConnectionHandle.java:1279)
    at
    com.jolbox.bonecp.ConnectionHandle.(ConnectionHandle.java:254)
    at
    com.jolbox.bonecp.ConnectionHandle.recreateConnectionHandle(ConnectionHandle.java:273)
    at com.jolbox.bonecp.ConnectionHandle.close(ConnectionHandle.java:476)
    at
    org.springframework.jdbc.datasource.DataSourceUtils.doCloseConnection(DataSourceUtils.java:341)
    at
    org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:328)
    at
    org.springframework.jdbc.datasource.DataSourceUtils.releaseConnection(DataSourceUtils.java:294)
    at
    org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:411)
    at
    org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:456)
    at
    org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:464)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:472)
    at
    org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:477)</p>
  </blockquote>
  
  <p>Since it can't close connections, open connections reaches to max connection number, then app become unresponsive.</p>
  
  <p>I am not setting any transaction related properties. So transaction settings should be default. How can I fix this?</p>
  
  <p>Dependencies and configuration:</p>
  
  <p>bonecp 0.8.0-rc1
  postgresql 9.2-1002.jdbc4
  spring-jdbc 3.2.1.RELEASE</p>
  
  <pre><code>&lt;bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource"        destroy-method="close"&gt;         &lt;property name="driverClass" value="org.postgresql.Driver" /&gt;       &lt;property name="jdbcUrl" value="jdbc:postgresql://127.0.0.1/mkayman" /&gt;         &lt;property name="username" value="mkayman" /&gt;        &lt;property name="password" value="" /&gt;       &lt;property name="idleConnectionTestPeriodInMinutes" value="5" /&gt;         &lt;property name="idleMaxAgeInMinutes" value="30" /&gt;      &lt;property name="maxConnectionsPerPartition" value="5" /&gt;        &lt;property name="minConnectionsPerPartition" value="2" /&gt;        &lt;property name="partitionCount" value="2" /&gt;        &lt;property name="acquireIncrement" value="1" /&gt;      &lt;property name="statementsCacheSize" value="100" /&gt;     &lt;/bean&gt;
  </code></pre>