spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Test for unclosed EM after implicit query transaction under NEVER propagation.

Open ettavolt opened this issue 2 years ago • 0 comments

I've failed to mock this completely, but IRL a subsequent call to, say, persist uses an already opened EM instead of throwing. EM is closed on exit from executeWithoutResult.

Initially caught this in a system with schema-based multi-tenancy, where I've tried to force no transaction (and no current connection) on call of tenant iterating method with @Transactional(NEVER) and got the iterations accessing the same tenant's schema.

IMO, there should be no synchronization unless transaction is open, but a code comment in AbstractPlatformTransactionManager#getTransaction(TransactionDefinition definition) says otherwise.

ettavolt avatar Sep 18 '22 19:09 ettavolt