I have a method annotated with @Transactional. In this method a data object is parsed and should finally be saved in the database. If the parsing fails, this method does not throw an exception, but returns with a special value.
How can I tell the transaction to rollback? Normally the transactions created by @Transactional just rollback on exception.
Please don’t tell me why I should not return a special value or why using @Transactional does not make sense in my case. I need an effective solution, even if its not the nicest design – I know it by myself.
Thanks for your help!
1 Answer