提交 5b256d44 编写于 作者: F frederikheremans

ACT-186 'table not found' matching added for all supported DB's

上级 e17674a7
......@@ -224,8 +224,7 @@ public class DbSqlSessionFactory implements SessionFactory, ProcessEngineConfigu
success = true;
} catch (Exception e) {
String exceptionMessage = e.getMessage();
if ((exceptionMessage.indexOf("Table") != -1) && (exceptionMessage.indexOf("not found") != -1)) {
if (isMissingTablesException(e)) {
throw new ActivitiException(
"no activiti tables in db. set property db.schema.strategy=create-drop in activiti.properties for automatic schema creation", e);
} else {
......@@ -307,6 +306,27 @@ public class DbSqlSessionFactory implements SessionFactory, ProcessEngineConfigu
log.fine("activiti db schema " + operation + " successful");
}
protected boolean isMissingTablesException(Exception e) {
String exceptionMessage = e.getMessage();
if(e.getMessage() != null) {
// Matches message returned from H2
if ((exceptionMessage.indexOf("Table") != -1) && (exceptionMessage.indexOf("not found") != -1)) {
return true;
}
// Message returned from MySQL and Oracle
if (((exceptionMessage.indexOf("Table") != -1 || exceptionMessage.indexOf("table") != -1)) && (exceptionMessage.indexOf("doesn't exist") != -1)) {
return true;
}
// Message returned from Postgres
if (((exceptionMessage.indexOf("relation") != -1 || exceptionMessage.indexOf("table") != -1)) && (exceptionMessage.indexOf("does not exist") != -1)) {
return true;
}
}
return false;
}
// getters and setters //////////////////////////////////////////////////////
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册