2011-07-11 36 views
0

我正在处理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> 
+0

查看更新后的persistence.xml文件。这就是解决方案:) – floshton

回答

0

你有没有配置的EclipseLink作为持久性提供?默认情况下,WAS使用自己的持久性提供者(包装OpenJPA)。

Configuring WAS Persistence Provider

+0

谢谢Terrell。我实际上已经在persistence.xml文件中配置了它。我只是将persistence.xml添加到最初的问题。 此外,我已将EclipseLink jar添加到应用程序的类路径中。不知道我是否需要其他东西。 – floshton

+2

我找到了一个解决方案。我需要修改persistence.xml。我编辑了一个反映额外行的更新的原始问题。 – floshton

+0

请不要只发布链接的答案。如果链接包含答案,请在StackOverflow的答案中放入答案的相关部分。如果链接后面的内容发生变化,或内容被删除,您的答案不再回答这个问题。 –

相关问题