1 Reply Latest reply on Nov 21, 2012 2:25 PM by marlonpatrick10

    The EJBTransactionRolledbackException is thrown, but the rollback does not happen

    marlonpatrick10

      I'm developing an application over JBoss AS 7.1 using EJB 3.1. All beans are CMT, I'm with the following problem:

       

      I have a business method with @TransactionAttribute(TransactionAttributeType.REQUIRED), this method I try to delete an entity, in this case a User. However, when the container does commit an error occurs because the user is being referenced by another table (org.hibernate.exception.ConstraintViolationException). So far so good, it's expected. The problem is that the rollback does not happen and operations before the statment that causes the error are not reversed.

       

       

      Business method:

       

      
      public void deleteUser(User user) {
      
      user.setAuditableOperation(AuditableOperations.DELETION);
      this.myDAO.delete(user);
      }
      
      
      

       

      Hibernate log:

       

      13:43:11,269 INFO  [stdout] (http--0.0.0.0-8080-3) Hibernate: 
      13:43:11,269 INFO  [stdout] (http--0.0.0.0-8080-3)     insert 
      13:43:11,269 INFO  [stdout] (http--0.0.0.0-8080-3)     into
      13:43:11,269 INFO  [stdout] (http--0.0.0.0-8080-3)         AuditLog
      13:43:11,270 INFO  [stdout] (http--0.0.0.0-8080-3)         (insertion_date, insertion_user, update_date, update_user, version, auditablemodel, model_id, operation, xml, id) 
      13:43:11,270 INFO  [stdout] (http--0.0.0.0-8080-3)     values
      13:43:11,271 INFO  [stdout] (http--0.0.0.0-8080-3)         (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
      13:43:11,285 INFO  [stdout] (http--0.0.0.0-8080-3) Hibernate: 
      13:43:11,285 INFO  [stdout] (http--0.0.0.0-8080-3)     delete 
      13:43:11,285 INFO  [stdout] (http--0.0.0.0-8080-3)     from
      13:43:11,285 INFO  [stdout] (http--0.0.0.0-8080-3)         systemuser_accessprofile 
      13:43:11,286 INFO  [stdout] (http--0.0.0.0-8080-3)     where
      13:43:11,286 INFO  [stdout] (http--0.0.0.0-8080-3)         systemuser=?
      13:43:11,296 INFO  [stdout] (http--0.0.0.0-8080-3) Hibernate: 
      13:43:11,296 INFO  [stdout] (http--0.0.0.0-8080-3)     delete 
      13:43:11,297 INFO  [stdout] (http--0.0.0.0-8080-3)     from
      13:43:11,297 INFO  [stdout] (http--0.0.0.0-8080-3)         systemuser 
      13:43:11,298 INFO  [stdout] (http--0.0.0.0-8080-3)     where
      13:43:11,298 INFO  [stdout] (http--0.0.0.0-8080-3)         id=? 
      13:43:11,298 INFO  [stdout] (http--0.0.0.0-8080-3)         and version=?
      
      

       

      Exception trace:

       

       

      13:43:11,306 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--0.0.0.0-8080-3) SQL Error: 0, SQLState: 23503
      13:43:11,306 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--0.0.0.0-8080-3) ERROR: update or delete on table "systemuser" violates foreign key constraint "operatingunit_contact_fk_contact" on table "operatingunit_contact"
        Detalhe: Key (id)=(7) is still referenced from table "operatingunit_contact".
      13:43:11,311 WARN  [com.arjuna.ats.arjuna] (http--0.0.0.0-8080-3) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffff7f000101:-48501c35:50ad0112:25, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@d34f0f >: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: ERROR: update or delete on table "systemuser" violates foreign key constraint "operatingunit_contact_fk_contact" on table "operatingunit_contact"
        Detalhe: Key (id)=(7) is still referenced from table "operatingunit_contact".
                at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1295) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.ejb.AbstractEntityManagerImpl$CallbackExceptionMapperImpl.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1481) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:109) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:53) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76)
                at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273)
                at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
                at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:164)
                at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165)
                at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117)
                at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
                at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:92) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:232) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
                at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
                at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
                at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
                at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
                at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
                at com.alc.ceos.core.business.AccessControlBean$$$view3.deleteUser(Unknown Source) [ceos-ejb-0.0.1.jar:]
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
                at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
                at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:111) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at com.alc.ceos.core.business.AccessControlBean$Proxy$_$$_Weld$Proxy$.deleteUser(AccessControlBean$Proxy$_$$_Weld$Proxy$.java) [ceos-ejb-0.0.1.jar:]
                at com.alc.ceos.web.view.UserView.delete(UserView.java:79) [ceos-web-core-0.0.1.jar:]
                at com.alc.ceos.web.view.UserView$Proxy$_$$_WeldClientProxy.delete(UserView$Proxy$_$$_WeldClientProxy.java) [ceos-web-core-0.0.1.jar:]
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
                at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
                at org.apache.el.parser.AstValue.invoke(AstValue.java:262) [jbossweb-7.0.13.Final.jar:]
                at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278) [jbossweb-7.0.13.Final.jar:]
                at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
                at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at javax.faces.component.UICommand.broadcast(UICommand.java:315) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
                at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145) [prettyfaces-jsf2-3.3.3.jar:]
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:840) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:622) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:560) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:488) [jbossweb-7.0.13.Final.jar:]
                at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137) [prettyfaces-jsf2-3.3.3.jar:]
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:489) [jbossweb-7.0.13.Final.jar:]
                at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
                at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09]
      Caused by: org.hibernate.exception.ConstraintViolationException: ERROR: update or delete on table "systemuser" violates foreign key constraint "operatingunit_contact_fk_contact" on table "operatingunit_contact"
        Detalhe: Key (id)=(7) is still referenced from table "operatingunit_contact".
                at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:128) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at $Proxy163.executeUpdate(Unknown Source)          at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3127) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3327) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:91) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:272) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:264) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:191) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                ... 85 more
      Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "systemuser" violates foreign key constraint "operatingunit_contact_fk_contact" on table "operatingunit_contact"
        Detalhe: Key (id)=(7) is still referenced from table "operatingunit_contact".
                at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103) [postgresql-9.1-901-1.jdbc4.jar:]
                at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836) [postgresql-9.1-901-1.jdbc4.jar:]
                at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) [postgresql-9.1-901-1.jdbc4.jar:]
                at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512) [postgresql-9.1-901-1.jdbc4.jar:]
                at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388) [postgresql-9.1-901-1.jdbc4.jar:]
                at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334) [postgresql-9.1-901-1.jdbc4.jar:]
                at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:493)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
                at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
                at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
                ... 98 more
      
      

       

       

      In the hibernate log as you can see, three operations are performed:

       

      1 - Insert int AuditLog

      2 - delete in systemuser_accessprofile

      3 - delete in systemuser

       

      The error happens in the last operation, but the other two are not reversed, and this is my real problem.

       

       

      Extra informations:

      JBoss AS 7.1

      EJB 3.1

      JPA 2(Hibernate 4.0.1)

      Seam Persistence(Seam Managed Persistence Context - SMPC)

      Postgres 9

      A interceptor insert a AuditLog for all updates/deletes

      User has a relationship with AccessProfile:

      @ManyToMany(fetch = FetchType.LAZY)
      @JoinTable(name = "systemuser_accessprofile", joinColumns = @JoinColumn(name = "systemuser",
      referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "accessprofile",
      referencedColumnName = "id"))
      private Set<AccessProfile> profiles;
      

       

       

      Thank you in advance.