我正在處理NetBeans中開發的應用程序。它使用單個實體,可以從數據庫中檢索或保留新的實體。它使用JPA 2.0 w/EclipseLink。部署在捆綁的Glassfish中時,它可以正常工作。但是,在部署到WAS 7.0.0.9(已包含JPA 2.0修補程序)時,我可以檢索實體,但我無法堅持它們。我可以檢索實體但我無法堅持WebSphere 7 JPA
我的代碼堅持,一個無狀態EJB 3.0中是:
public void create(MyEntity entity) {
getEntityManager().persist(entity);
}
我已經設置日誌屬性爲:最詳細,這樣我就可以有更多的細節,
<property name="eclipselink.logging.level" value="FINEST"/>
但我進入日誌是:
[EL Finer]: 2011-07-11 17:02:59.813--UnitOfWork(1634296169)--Thread(Thread[WebContainer : 9,5,main])--initialize identitymaps
[EL Finer]: 2011-07-11 17:02:59.815--ServerSession(833630640)--Thread(Thread[WebContainer : 9,5,main])--client acquired
[EL Finest]: 2011-07-11 17:02:59.815--UnitOfWork(137562163)--Thread(Thread[WebContainer : 9,5,main])--PERSIST operation called on: PU_TEST.
[EL Finer]: 2011-07-11 17:02:59.816--UnitOfWork(137562163)--Thread(Thread[WebContainer : 9,5,main])--initialize identitymaps
服務器日誌顯示沒有關於這方面的信息。有任何想法嗎?
在此先感謝。
SOLUTION: 這是工作persistence.xml文件
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="fonacotCap" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/fonacotCap</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-server" value="WebSphere_7"/>
<property name="eclipselink.target-database" value="Informix"/>
<property name="eclipselink.weaving" value="true"/>**
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="eclipselink.logging.file" value="/opt/apps/libs/persistence.log"/>
</properties>
</persistence-unit> </persistence>
查看更新後的persistence.xml文件。這就是解決方案:) – floshton