I am seeing the following (truncated) stacktrace in the server.log file of JBoss 7.1.1 Final:
Caused by: org.postgresql.util.PSQLException:
ERROR: current t
You need to rollback. The JDBC Postgres driver is pretty bad. But if you want to keep your transaction, and just rollback that error, you can use savepoints:
try {
_stmt = connection.createStatement();
_savePoint = connection.setSavepoint("sp01");
_result = _stmt.executeUpdate(sentence) > 0;
} catch (Exception e){
if (_savePoint!=null){
connection.rollback(_savePoint);
}
}
Read more here:
http://www.postgresql.org/docs/8.1/static/sql-savepoint.html