I have started using Kotlin Exposed. One of the early difficulties I got into was that I can’t seem to be able to do a rollback. eg.
transaction {
val result = doSomething()
if (result == false) {
this.rollback()
}
}
In the above code, doSomething() invokes many DAO.new {… }. I want to commit or rollback based on the overall result. However all the DAOs automatically get inserted into the table and the transaction committed. If the question is not entirely clear I could easily contribute a test case.
Thanks for the replies. Finally manged through explicit control of transactions rather than using transaction blocks, since throwing in exception in order to trigger a rollback wasn’t quite appropriate in our context.