[jbpm-commits] JBoss JBPM SVN: r5832 - jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Oct 28 11:12:50 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-10-28 11:12:50 -0400 (Wed, 28 Oct 2009)
New Revision: 5832

Modified:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CheckDbCmd.java
Log:
make jbpm report proper error message in case there is no jbpm schema

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CheckDbCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CheckDbCmd.java	2009-10-28 15:11:38 UTC (rev 5831)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CheckDbCmd.java	2009-10-28 15:12:50 UTC (rev 5832)
@@ -29,6 +29,7 @@
 import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
 import org.jbpm.pvm.internal.env.EnvironmentImpl;
 import org.jbpm.pvm.internal.id.PropertyImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
 
 /**
  * @author Tom Baeyens
@@ -44,8 +45,14 @@
 
     // if table JBPM4_PROPERTIES doesn't exist, 
     if (!PropertyImpl.propertiesTableExists(session)) {
-      // tell users to run upgrade
-      throw new JbpmException("jBPM DB schema not in sync with library version: no JBPM4_PROPERTIES table.   Run the upgrade tool first.");
+      if (!executionTableExists(session)) {
+        // tell users to run create.schema
+        throw new JbpmException("no jBPM DB schema: no JBPM4_EXECUTION table.   Run the create.jbpm.schema target first in the install tool.");
+        
+      } else {
+        // tell users to run upgrade
+        throw new JbpmException("jBPM DB schema not in sync with library version: no JBPM4_PROPERTIES table.   Run the upgrade target first in the install tool.");
+      }
       
     } else {
       Long nextDbid = PropertyImpl.getNextDbid(session);
@@ -70,5 +77,19 @@
 
     return null;
   }
+  
+  public static boolean executionTableExists(Session session) {
+    try {
+      session.createQuery("from "+ExecutionImpl.class.getName())
+        .setMaxResults(1)
+        .uniqueResult();
+      return true;
+      
+    } catch (Exception e) {
+      return false;
+    }
+  }
 
+
+
 }



More information about the jbpm-commits mailing list