Whimusical
Whimusical

Reputation: 6629

@Transactional method call within @Transactional method (both with default propagation)

I have the following setting (it's an analogy), and the repository changes on methodB are not rollbacked. Propagations should be default = REQUIRED, so what could be the explanation?

Parent.java

@Transactional
public void methodA(){
   child.methodB();
   anotherMethodThatThrowsARuntimeException();
}

Child.java

@Transactional
public void methodB(){
   repository.save(entity)
}

First of all, is my understanding correct in that I should expected everything rollbacked?

Even if all this situation is happening when this code is wrapped under a @Transactional(isolation = Isolation.READ_UNCOMMITTED) test?

EDIT: Just for the sake of the resolution: the problem was that.SQL rollback was indeed at the end of of outer transaction but the managed context was not cleared so rollback from inner transaction was not visible

Upvotes: 0

Views: 243

Answers (1)

uğur taş
uğur taş

Reputation: 365

Some database engines don't have support for transaction. First check your database engine. MyISAM engine of MySQL is an example for this case.

Upvotes: 2

Related Questions