There is one way, but you must be sure that you really need it. In almost all cases, you can enter an entity manager.
Here's how to do it if no other option exists:
EntityManagerFactory emf = obtainEntityManagerFactory();
In short, for every transaction started by the JpaTransactionManager spring, an object manager is stored in ThreadLocal , using factory as the key.
Bozho source share