Paul Higgins
02/07/2022, 9:29 PMBogdan
02/08/2022, 3:45 PMExposed
must have access to the connection inside the transactionPaul Higgins
02/09/2022, 12:18 AMtransaction {
with(TransactionManager.current()) {
val savepoint = connection.setSavepoint("savepoint")
val thingToUpdate = Thing.find { Thing.id eq "anID" }.first()
thingToUpdate.field = "newValue"
connection.rollback(savepoint)
}
}
Bogdan
02/10/2022, 7:05 PMwith(TransactionManager.current())
is redundanttransaction {
val savepoint = connection.setSavepoint("test")
entityCache.flush()
connection.rollback(savepoint)
}
Paul Higgins
02/10/2022, 7:30 PMBogdan
02/11/2022, 2:26 PMPaul Higgins
02/11/2022, 7:48 PMDatabase.connect("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;IGNORECASE=true;")
It works when I do explicitly write it out, so it's only failing when I use the connection.setSavepoint and .rollback methods
exec("SAVEPOINT saveme")
exec("ROLLBACK TO SAVEPOINT saveme")
Bogdan
02/12/2022, 3:38 PMautocommit
?Paul Higgins
02/15/2022, 8:50 PMBogdan
02/17/2022, 4:29 PMI didn't change the autocommit from whatever was the default.
autocommit = true
by default. In the examples, when working with savepoint, autocommit is set to false