HiAll, I was confused by the EclipseLink for Tomcat documentation that said:
Limitations for JPA: There is no container-managed control injection available for @PersistenceContext - use Persistence.createEntityManagerFactory (JTA_PU_NAME)
as well as this question and answer :
but a typical Spring JPA configuration looks like this, so you donโt need to create an EntityManager manually: @PersistenceContext private EntityManager em;
So the question is: can I use this @PersistenceContext annotation for entityManager to make sure it will be created automatically, and I donโt need to manually create it?
The @Transactional annotation is currently not working properly, and I'm afraid that this involves creating the entity manager manually!
Please need help.
source share