开发者

Is it possible to use @Transational worked in Spring, Eclipselink &Tomcat environment?

HiAll, I was confused by the EclipseLink for Tomcat documentation saying:

Limitations to JPA: No @PersistenceContext injection of a container 开发者_如何学Pythonmanaged persistence unit is available - use Persistence.createEntityManagerFactory(JTA_PU_NAME)

and, also by this question&answer:

but the typical JPA configuration in Spring looks like this, so you don't need to create EntityManager manually : @PersistenceContext private EntityManager em;

So, the question is: may I use this annotation @PersistenceContext for the entityManager to be sure that it will be created automatically and I dont need to create it manually?

Currently my @Transactional annotation does not work properly and I'm afraid it is because of creating the entity manager manually!

Please, need help.


EclipseLink documentation says that @PersistenceContext is not handled by Tomcat on its own. However, if you use Spring, @PersistenceContext is handled by Spring, so that you can use it.

See also:

  • 13.5 JPA
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜