I am using Transaction management with Spring and Hibernate.
My situation is as follow:
I have got bean A which is sorrounded by transaction
and it call bean B which is defined with transaction including the attribute 'PROPAGATION_REQUIRED'
B in this case doesn't open new transaction but uses the exsiting one (saw in the logs: 'Participating in existing transaction'). However in case the method in B will throw a runtimeException, on its way back to A it will dirty the transaction and will cause it to be marked for roll-back, even if the external method of A will catch the exception and won't throw it away. I think that this behavior is wrong, in this case I want A to control the transaction and B should not interrupt the transaction in any case.
Is there any way to define B to open transaction if no transaction defined but DO NOTHING if it is already inside an exising transaction and let the upper level make the decision whether to commit or roll-back?
See more responses about this issue in a thread in Spring community here.