我需要将EntityManager jndi-lookup配置从xml转换为java
这是包含jndi-lookup的root-servlet.xml文件
<jee:jndi-lookup jndi-name="java:comp/env/test/EntityManager" id="entityManager" expected-type="javax.persistence.EntityManager" />
web.xml包含持久性上下文
<persistence-context-ref>
<persistence-context-ref-name>test/EntityManager</persistence-context-ref-name>
<persistence-unit-name>testdatabase</persistence-unit-name>
</persistence-context-ref>
用于持久性配置的持久性
<persistence-unit name="aigxdatabase">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/skyruler-postgresql</jta-data-source>
<class>pt.aig.aigx.messagescheduler.library.entities.ScheduledMessage</class>
<properties>
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.use_sql_comments" value="false" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="hibernate.transaction.auto_close_session"
value="true" />
<property name="javax.persistence.transactionType " value="jta" />
<property name="hibernate.current_session_context_class"
value="jta" />
<property name="hibernate.connection.release_mode" value="auto" />
<property name="hibernate.jdbc.lob.non_contextual_creation" value="true"/>
</properties>
</persistence-unit>