Author: tom.baeyens(a)jboss.com
Date: 2010-01-20 05:58:22 -0500 (Wed, 20 Jan 2010)
New Revision: 6102
Modified:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
Log:
JBPM-2714 reused check for properties table as postgresql ignores everything after a SQL
exception
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2010-01-20 10:51:17 UTC
(rev 6101)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2010-01-20 10:58:22 UTC
(rev 6102)
@@ -48,6 +48,7 @@
static String database;
static JbpmVersion jbpmVersion;
+ static boolean propertiesTableExists;
public static void main(String[] args) {
if ( (args==null)
@@ -68,7 +69,8 @@
private static final long serialVersionUID = 1L;
public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
- if (!PropertyImpl.propertiesTableExists(session)) {
+ propertiesTableExists = PropertyImpl.propertiesTableExists(session);
+ if (!propertiesTableExists) {
try {
session.createSQLQuery("select CLASSNAME_ from
JBPM4_VARIABLE").list();
jbpmVersion = JbpmVersion.V_4_1;
@@ -104,13 +106,16 @@
}
if (jbpmVersion.isEarlier(JbpmVersion.V_4_2)) {
- boolean isFfirstPartUpgrade42Completed =
PropertyImpl.isFirstPartUpgrade42Completed(session);
- if (!isFfirstPartUpgrade42Completed) {
+ // the first part of the upgrade to 4.2 might already be done before as
that happens in the next transaction (and that next transaction might have failed in a
previous run of upgrade)
+ // in that case, the next part is skipped
+ if (!propertiesTableExists) {
DbHelper.executeSqlResource("upgrade-4.1-to-4.2/jbpm." +
database + ".upgrade.sql", session);
PropertyImpl.initializeNextDbid(session);
+ // we set the version to 4.1 as the next transaction might fail
PropertyImpl.setDbVersionTo41(session);
}
}
+ // transaction is now committed as the next transaction requires the NextDbid
property to be initialized and committed.
return null;
}
});
Show replies by date