我正在使用Hibernate和EJB ...我从Container获得了EntityManager,当我试图坚持时,我遇到了以下错误..可能有人帮忙吗?
[1/25/14 23:12:46:832 CST] 00000056 SystemOut O 2014-01-25 23:12:46错误XXXXXXX服务:114 - XXXXX筛选失败 org.apache.openjpa.persistence.ArgumentException:尝试将实例“XXXXXXXXVO @ 9941827f”强制转换为PersistenceCapable失败。确保它已得到增强。 失败对象:com.XXXXX.XXXXX.XXXXX.vo.XXXXXVO@9941827f 在org.apache.openjpa.kernel.BrokerImpl.assertPersistenceCapable(BrokerImpl.java:4665) 在org.apache.openjpa.kernel.BrokerImpl.persistInternal(BrokerImpl.java:2626) 在org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2571) 在org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2554) 在org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2458) 在org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1077) 在org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:716) 在com.ibm.ws.jpa.management.JPAExEmInvocation.persist(JPAExEmInvocation.java:317) 在com.ibm.ws.jpa.management.JPAEntityManager.persist(JPAEntityManager.java:143) 在XXXXXXX.persistCCCCResult(XXXXXXX.java:192) 在XXXXXXX.prepareCCCCResponse(XXXXXXX.java:176) 在XXXXXXX.requestCCCCCcreening(XXXXXXX.java:108) 在XXXXXXXService.requestCCCCCcreening(CCCCCervice.java:59) 在XXXXXXXXX,EJSRemote0SLCCCCCervice_0e27d761.requestCCCCCcreening(EJSRemote0SLCCCCCervice_0e27d761.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) 在java.lang.reflect.Method.invoke(Method.java:611) 在com.ibm.rmi.util.ProxyUtil $ 4.run(ProxyUtil.java:609) 在java.security.AccessController.doPrivileged(AccessController.java:280) at com.ibm.rmi.util.ProxyUtil.invokeWithClassLoaders(ProxyUtil.java:606) 在com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:1177) 在$ Proxy225.requestCCCCCcreening(未知来源) 在com.XXXXX.XXXXX.XXXXX.service.remote.XXXXX._CCCCCerviceRemote_Stub.requestCCCCCcreening(_CCCCCerviceRemote_Stub.java:1) 在com.XXXXX.XXXXX.servlet.CCCCCcreening.doGet(CCCCCcreening.java:68) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:575) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:668) 在com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1214) 在com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774) 在com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456) 在com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) 在com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1027) 在com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87) 在com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:895) 在com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) 在com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195) 在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458) 在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:522) 在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:311) 在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:282) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) 在com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) 在com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) 在com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) 在com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) 在com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) 在com.ibm.io.async.ResultHandler $ 2.run(ResultHandler.java:905) 在com.ibm.ws.util.ThreadPool $ Worker.run(ThreadPool.java:1783)
<?xml version="1.0"?>
<persistence 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" version="2.0">
<persistence-unit name="poc" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>XXXXXXXXX.TempVO</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver" />
<property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@XXXXXXXXX" />
<property name="javax.persistence.jdbc.user" value="XXXXX" />
<property name="javax.persistence.jdbc.password" value="XXXXX" />
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
答案 0 :(得分:1)
根据Java堆栈跟踪,您正在使用OpenJPA而不是Hibernate,对吧?
如果您已启用运行时增强功能,则必须列出所有实体。您是否尝试使用OpenJPA增强程序增强Java类?查找有关增强实体here的更多信息。