I have two transaction manager in my application, I have to execute a dynamically generated native query, for which I need to fetch Current transaction EntityManager.

Is there any way we can get the Current Transaction (created by using @Transactional annotation) entity manager?

1 Answers

0
Mạnh Quyết Nguyễn On

You can use TransactionAspectSupport.html#currentTransactionInfo to access the current transaction.

Edit: Well, if you just need to access the EntityManager bean, you can directly inject it to your service