Using JPA2 in Tomcat 6: @PersitenceContext doesn't work, EntityManager is null

余生颓废 提交于 2019-11-30 13:52:12
BalusC

Tomcat is not a Java EE container, so there are limitations related to container managed factories and dependency injection. Among others, you need to manually create the EntityManagerFactory and the EntityManager.

Hibernate documentation isn't clear on that, so here's the Eclipselink one: Tomcat/JPA tutorial. Check the "Limitations to JPA" section, this applies as good to Hibernate.

See also:

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!