Prevent org.postgresql.util.PSQLException: Cannot change transaction read-only property in the middle of a transaction

when release connection to pool,bonecp will call setReadonly on connection,if there is a transaction and is not ended,postgresql(maybe other database) will throw exception.
org.postgresql.util.PSQLException: Cannot change transaction read-only property in the middle of a transaction

the resolution is try rollback to end transaction on the reuse connection