I have a problem with @Transactional annotation.
I have a method that does some things, and inside I throw and break an IllegalArgumentException .
I think (even if I caught the exception) that it sets the transaction as rollbackOnly (some sort of trigger for throwing an exception), and it ends without committing the transaction.
Here is the error:
org.springframework.transaction.TransactionSystemException : Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
I could add @Transactional no-rollback - for the exception that I picked and caught, but I don't think this is a real solution.
Maybe there is a way to rollback rollbackOnly on a transaction, but I don't think it's best practice too ...
So, you know how to do this?
Thanks,
java spring hibernate jpa
Rod
source share