0 Replies Latest reply on Nov 26, 2008 9:37 PM by trouby

    Seam and Jbpm createSchema - transactions problem

    trouby

      Hey,


      I have a simple Seam components that injects jbpmContext in with a very simple method that creates the JBPM schema,
      Here's the code:



      @In
      private JbpmContext jbpmContext;
      
      public void createSchema() {
      jbpmContext.getJbpmConfiguration().createSchema();
      }
      



      When invokes, this code results the following error:


      java.sql.SQLException: You cannot commit during a managed transaction!
              at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:581)
              at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:482)
              at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:30)
              at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:180)
              at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
              at org.jbpm.persistence.db.DbPersistenceServiceFactory.createSchema(DbPersistenceServiceFactory.java:108)
              at org.jbpm.JbpmConfiguration.createSchema(JbpmConfiguration.java:459)
              at org.jbpm.JbpmConfiguration.createSchema(JbpmConfiguration.java:451)
              at velo.ejb.impl.WorkflowBean.createJbpmSchema(WorkflowBean.java:55)
              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:597)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
              at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      




      This is probably since JBPM commits the transaction when the method is invoked, I tried to annotate the method with:


      @Transactional(TransactionPropagationType.SUPPORTS)
      



      But it didn't do any change,


      How can I make seam not to start/commit the transaction and leave the work for JBPM?



      Thanks,



      Asaf.