You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@Transactional not working when using two contexts and @Configurable weaved with AspectJ #11461
Provided test case where inside a @Transactional method, the previously persisted entity is not present in entity manager, eg:
@Transactional
public void doWork() {
TestTable entity = testTableRepository.save( new TestTable( "test" ) );
Assert.assertTrue( entityManager.contains( entity ) );
}
From my investigation, issue is related to transaction managers mixing from the two contexts because of AnnotationTransactionAspect caching of a transaction manager from previous context.
Thus, the @Transactional method uses the previous context transaction manager (weaved aspect), and the repository save method will use the current context transaction manager creating a new temporary transaction that closes immediately after entity is persisted.
Activity
snicoll commentedon Jan 2, 2018
See also #11123
wilkinsona commentedon Apr 26, 2018
This is the same as, or at least very similar to, https://jira.spring.io/browse/SPR-16227. I'm going to close this issue in favour of that Spring Framework issue. I've just commented on it providing a sample that illustrates a case of an aspect using a stale bean factory.
cdalexndr commentedon Aug 18, 2020
Main issue: spring-projects/spring-framework#11019