Flushing should not affect transaction management atl all. When transaction is rolled back, all changes made to the database state (i.e. changes flushed by Hibernate) inside that transaction are rolled back.
Default propagation policy for
@Transactional
isPROPAGATION_REQUIRED
. It means that you can safely invoke@Transactional
methods from other@Transactional
methods, and they'll use the same transaction created by the top level transaction method. It's not so if you provide different propagation settings explicitly.
So, it means that any failure that happens during execution of the top level @Transactional
method (i.e. any exception thrown from that method) should cause rollback, and all changes should be rolled back in this case.
If you observe different behavior, perhaps something is misconfigured (for example, the top level @Transactional
doesn't take effect for some reason). Try to reproduce this behavior in tests.