7 Replies Latest reply on Nov 26, 2008 3:02 PM by Mauricio Salatino

    java.sql.SQLException: You cannot commit during a managed tr

    asaf sh Expert


      I have created a very simple seam component that injects the jbpmContext and uses it to create the schema, this is the code:

      public class WorkflowManager {
      private JbpmContext jbpmContext;
      public void createJbpmSchema() {

      When invoked, I get the following exception:
      21:13:32,867 ERROR [SchemaExport] schema export unsuccessful
      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)

      I looked at the source code of the createSchema method,
      Seems like it's just invoking jbpmContext.close(); at the end.

      My JBPM/hibernate configured in the right way not to start/close a transaction it didn't start.

      What is the reason of the exception?