[jboss-user] [EJB 3.0] - EJB3DeleteEventListener.performDetachedEntityDeletionCheck

tom_goring do-not-reply at jboss.com
Wed Mar 12 11:39:00 EDT 2008


Hi,

I'm upgrading to Seam 2.0 and included jars (Hibernate EntityManager 3.3.1.GA, etc).

I have some code that used to work OK but now I'm getting the stack attached  (when running integration tests in the embedded container).

If I have a Parent with a Set of children and I delete one of those children (that is set to cascade) this works OK.  As soon as I call flush after the update manually I get the stack.


  | @Stateless
  | @Remote(ContractManager.class)
  | @Local(ContractManagerLocal.class)
  | @Name("contractManager")
  | public class ContractManagerBean implements ContractManager {
  | ...
  | 	public Contract updateContract(Contract contract) {
  | 		contract = em.merge(contract);
  | 		// Add this line I get a stack... remove and it's OK
  | 		em.flush();
  | 		return contract;
  | 	}
  | 

I need to control the flushing in my case in a more complicated example due to database constraints.

Any advise ?


  | ERROR [org.jboss.seam.jsf.SeamPhaseListener] uncaught exception
  | java.lang.IllegalStateException: Could not commit transaction
  | 	at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:592)
  | 	at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:325)
  | 	at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:226)
  | 	at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)
  | 	at org.jboss.seam.mock.BaseSeamTest$Request.invokeApplicationPhase(BaseSeamTest.java:666)
  | 	at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:598)
  | 	at org.jboss.seam.mock.BaseSeamTest$Request.access$300(BaseSeamTest.java:185)
  | 	at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:519)
  | 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
  | 	at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
  | 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | 	at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
  | 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | 	at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
  | 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | 	at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
  | 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | 	at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
  | 	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
  | 	at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
  | 	at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:514)
  | 	at jnet.emtest.bl.company.TestContractManager.testCRUDKids(TestContractManager.java:183)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:585)
  | 	at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
  | 	at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
  | 	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:607)
  | 	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:874)
  | 	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
  | 	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
  | 	at org.testng.TestRunner.runWorkers(TestRunner.java:689)
  | 	at org.testng.TestRunner.privateRun(TestRunner.java:566)
  | 	at org.testng.TestRunner.run(TestRunner.java:466)
  | 	at org.testng.SuiteRunner.runTest(SuiteRunner.java:301)
  | 	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:296)
  | 	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:276)
  | 	at org.testng.SuiteRunner.run(SuiteRunner.java:191)
  | 	at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:808)
  | 	at org.testng.TestNG.runSuitesLocally(TestNG.java:776)
  | 	at org.testng.TestNG.run(TestNG.java:701)
  | 	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
  | 	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
  | Caused by: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
  | 	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1267)
  | 	at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
  | 	at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
  | 	at org.jboss.embedded.adapters.LocalOnlyUserTransaction.commit(LocalOnlyUserTransaction.java:91)
  | 	at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
  | 	at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:582)
  | 	... 43 more
  | Caused by: javax.persistence.PersistenceException: java.lang.IllegalArgumentException: Removing a detached instance jnet.dm.company.ContractRate#2
  | 	at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:527)
  | 	at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
  | 	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:249)
  | 	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:88)
  | 	at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
  | 	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1256)
  | 	... 48 more
  | Caused by: java.lang.IllegalArgumentException: Removing a detached instance jnet.dm.company.ContractRate#2
  | 	at org.hibernate.ejb.event.EJB3DeleteEventListener.performDetachedEntityDeletionCheck(EJB3DeleteEventListener.java:47)
  | 	at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:75)
  | 	at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:775)
  | 	at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
  | 	at org.hibernate.engine.Cascade.deleteOrphans(Cascade.java:355)
  | 	at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:324)
  | 	at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
  | 	at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
  | 	at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
  | 	at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
  | 	at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
  | 	at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
  | 	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
  | 	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
  | 	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
  | 	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
  | 	at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
  | 



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4136003#4136003

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4136003



More information about the jboss-user mailing list