Project in question uses Spring 4, Java 7, and persists to Oracle and PostgreSQL.
I'm writing integration tests for a service that persists data to both databases. For the integration test, I want to have both transactions rollback automatically. I know I can't use "repeated" annotations if not using Java 8, as I'll get a compile error. I can compile just fine if I put one annotation at the class level, and another at the method level. However, it appears that the higher annotation listed will not rollback. To clarify, if I declare either @Transactional
annotation (Oracle or PostgreSQL) as a standalone annotation at either the class or method level, that one rollback works perfectly. But if I implement one annotation at the class level, and the other annotation at the method level, the rollback will only work for the method level and not the class level.
I suspect multiple @Transactional
annotations would work just fine as long as the process is only trying to rollback one at a time. Ex: One method uses the Oracle Transaction and a different method uses the PostgreSQL Transaction.
Any thoughts?