int tries = 1;
while (true) {
try {
Savepoint savepoint = connection.setSavepoint();
try {
TransactionContext ctx = new DefaultTransactionContext(connection);
T value = callback.execute(ctx);
if (ctx.isRollbackOnly())
connection.rollback(savepoint);
else
connection.releaseSavepoint(savepoint);
return value;