EclipseLink静态编织实体会中断实体操作的删除

时间:2012-11-15 16:51:22

标签: eclipselink

我在EclipseLink-2.4.0中使用eclipselink-staticweave-maven-plugin 1.0.3成功执行了静态编织,但是当我也运行集成测试时。通过系统中的所有层,他们打破了。在startUp()方法中,我创建了一个用户实体,它在测试数据库中提交。但是在tearDown()方法中,我清除了DB状态,实体(已经编织过)无法被同一个EntityManager删除。

当没有编织实体时,测试没有错误。你觉得这个问题怎么样?

这里的异常状态也是:

  
    

java.lang.AbstractMethodError:nl.innovity.youbank.core.entity.user.User._persistence_setCacheKey(Lorg / eclipse / persistence / internal / identitymaps / CacheKey;)V         在org.eclipse.persistence.internal.descriptors.ObjectBuilder.updateCachedAttributes(ObjectBuilder.java:3790)         at org.eclipse.persistence.internal.sessions.MergeManager.mergeChangesOfWorkingCopyIntoOriginal(MergeManager.java:871)         at org.eclipse.persistence.internal.sessions.MergeManager.mergeChangesOfWorkingCopyIntoOriginal(MergeManager.java:687)         在org.eclipse.persistence.internal.sessions.MergeManager.mergeChanges(MergeManager.java:307)         at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.mergeChangesIntoParent(UnitOfWorkImpl.java:3260)         at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.mergeChangesIntoParent(RepeatableWriteUnitOfWork.java:369)         at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:283)         在org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1147)         at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84)         at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)         在nl.innovity.youbank.core.dao.DBManager.reinitDB(DBManager.java:510)         at nl.innovity.youbank.core.integration.IntegrationTest.tearDown(IntegrationTest.java:126)         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)         在java.lang.reflect.Method.invoke(Method.java:597)         在org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall(FrameworkMethod.java:44)         在org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)         在org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)         在org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)         在org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)         在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)         在org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)         在org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:193)         在org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:52)         在org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)         在org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:42)         在org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:184)         在org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)         在org.junit.runners.ParentRunner.run(ParentRunner.java:236)         在org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)         在org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:146)         在org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)         在java.lang.reflect.Method.invoke(Method.java:597)         在org.apache.maven.surefire.booter.ProviderFactory $ ClassLoaderProxy.invoke(ProviderFactory.java:103)         在$ Proxy0.invoke(未知来源)         在org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:145)         在org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:87)         在org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

  

提前致谢, 西麦

1 个答案:

答案 0 :(得分:4)

看起来像maven静态编织的配置问题 - 它使用的是与您运行的2.4版本不同的EclipseLink版本。查看您链接的文档,默认情况下将其设置为使用EclipseLink 2.3.2:我相信EclipseLink 2.4已更改为将_persistence_setCacheKey方法添加到编织中使用的PersistenceEntity。如果使用EclipseLink 2.3.2进行编织,则此方法将丢失。

您需要更改依赖项列表以指向EclipseLink 2.4作为您所描述的文档(它指的是使用除2.3.2之外的2.3.X版本)。