我們需要使用Eclipse Link將帶有JTA標籤的數據庫細節的用戶定義屬性替換掉。我有下面的persistence.xml使用DB值。如何在EclipseLink中使用JTA?
<?xml version="1.0" encoding="UTF-8"?>
<persistence xsi:SchemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit transaction-type="RESOURCE_LOCAL" name="UTILITY">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>ae.du.selfcare.utility.jpa.SelfcareJmsCreatett</class>
<properties>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:Oracle:thin:@IMP1SCDVDB1:1524:SCRTQC2"/>
<property name="javax.persistence.jdbc.user" value="******"/>
<property name="javax.persistence.jdbc.password" value="********"/>
<property name="eclipselink.connection-pool.default.initial" value="1"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="database"/>
</properties>
</persistence-unit>
</persistence>
我知道如何使用這個JTA與Hibernate
<persistence-unit name="PU" transaction-type="JTA">
<jta-data-source>java:jboss/datasources/Hanse</jta-data-source>
<class>model.Commodity</class>
<class>model....</class>
<class>model....</class>
<properties>
<!-- <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/> -->
<!-- <property name="hibernate.hbm2ddl.auto" value="update" /> -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<!-- <property name="hibernate.show_sql" value="true" /> -->
<property name="hibernate.enable_lazy_load_no_trans" value="true"/>
</properties>
</persistence-unit>
實現,但在這裏,我要與Eclipse鏈接。你能幫我解決嗎? 在此先感謝!!
您正在使用哪個應用程序服務器? – john
Weblogic服務器10.3.6 – user1111880