-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Closed
Copy link
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancementA general enhancement
Milestone
Description
In Kotlin all exceptions are effectively unchecked. Therefore, transactions will not be rolled back for functions like this:
@Transactional
fun example(): Unit {
runQuery()
throw MyCheckedException()
runQuery()
}
to achieve a correct behavior, the above code needs to be refactored as follows:
@Transactional(rollbackFor = [Exception::class])
fun example(): Unit {
runQuery()
throw MyCheckedException()
runQuery()
}
this isn't very intuitive and can lead to unexpected results. Furthermore, even if a developer is aware of this, he/she should not forget to specify rollbackFor
for every @Transactional
annotation.
It should be possible to configure application-wide defaults for rollbackFor
and noRollbackFor
kilink, ndendi, robzienert, EugeneEmelyanov, benduran and 26 more
Metadata
Metadata
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancementA general enhancement