有没有人尝试使用 Apache 的 DeltaSpike 在 Jetty 中设置事务性?我有一个 web 应用程序,我试图在使用 CDI 并具有 JTA 数据源的 Jetty 中运行。我的事务管理器没有被注入,它为空,因此导致错误。我包含了 deltaspike jpa jar 并按照下面给出的链接中的说明进行操作,但到目前为止它还没有工作。当我在 hibernate 类中进行深入调试时,我可以看到我的配置默认为 NOJTAPlatform,就好像没有配置 JTA。
任何想法,将不胜感激。
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jpa-module-impl</artifactId>
<version>0.5</version>
</dependency>
链接到 DeltaSpike 配置:
http://deltaspike.apache.org/jpa.html
我在 persistence.xml 中指定的数据源:
<persistence-unit name="database" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/myDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.id.new_generator_mappings" value="true"/>
</properties>
</persistence-unit>