[Resolved]Cannot startup engine after migration from 7.0.0 to 7.2.2

I am trying to upgrade Bonita BPM from 7.0.0 to 7.2.2, using Postgresql. Migration tool ran fine and completed with no issues. However I got DB exceptions while startup server.The exception is about casting boolean type data to integer. I guess it is trying to get default tenant from tenant table which has a boolean column, as DDL statement below. As result, I am not able to access login page with URL http://:8080/bonita

========================================================
– Table: tenant

– DROP TABLE tenant;

CREATE TABLE tenant
(
id bigint NOT NULL,
created bigint NOT NULL,
createdby character varying(50) NOT NULL,
description character varying(255),
defaulttenant boolean NOT NULL,
iconname character varying(50),
iconpath character varying(255),
name character varying(50) NOT NULL,
status character varying(15) NOT NULL,
CONSTRAINT tenant_pkey PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE tenant
OWNER TO bonitadbadmin;
GRANT ALL ON TABLE tenant TO bonitadbadmin;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE tenant TO demogroup;

=====================================
2016-04-21 14:17:45.452 +0800 org.bonitasoft.engine.EngineInitializer org.bonitasoft.engine.EngineInitializer initializeEngine
信息: Initializing Bonita Engine…
2016-04-21 14:17:45.452 +0800 org.bonitasoft.engine.EngineInitializer org.bonitasoft.engine.EngineInitializer initializeEngine
信息: Initializing Spring context…
2016-04-21 14:17:46.817 +0800 org.hibernate.dialect.H2Dialect org.hibernate.dialect.H2Dialect
WARN: HHH000431: Unable to determine H2 database version, certain features may not work
2016-04-21 14:17:49.489 +0800 org.hibernate.dialect.H2Dialect org.hibernate.dialect.H2Dialect
WARN: HHH000431: Unable to determine H2 database version, certain features may not work
2016-04-21 14:17:49.497 +0800 org.hibernate.type.TypeFactory org.hibernate.type.TypeFactory$TypeScopeImpl injectSessionFactory
WARN: HHH000233: Scoping types to session factory org.hibernate.internal.SessionFactoryImpl@33b79fb3 after already scoped org.hibernate.internal.SessionFactoryImpl@43e85307
2016-04-21 14:17:50.969 +0800 org.bonitasoft.engine.EngineInitializer org.bonitasoft.engine.EngineInitializer initializeEngine
信息: Initializing platform…
2016-04-21 14:17:50.969 +0800 org.bonitasoft.engine.EngineInitializer org.bonitasoft.engine.EngineInitializer initPlatform
信息: Creating platform…
2016-04-21 14:17:51.122 +0800 org.bonitasoft.engine.EngineInitializer org.bonitasoft.engine.EngineInitializer initializeEngine
信息: Platform initialized successfully.
2016-04-21 14:17:51.123 +0800 org.bonitasoft.engine.EngineInitializer org.bonitasoft.engine.EngineInitializer startPlatform
信息: Starting platform…
2016-04-21 14:17:52.281 +0800 org.hibernate.engine.jdbc.spi.SqlExceptionHelper org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 0, SQLState: 42883
2016-04-21 14:17:52.282 +0800 org.hibernate.engine.jdbc.spi.SqlExceptionHelper org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: 错误: 操作符不存在: boolean = integer
建议:没有匹配指定名称和参数类型的操作符. 您也许需要增加明确的类型转换.
位置:138
2016-04-21 14:17:52.288 +0800 org.bonitasoft.engine.EngineInitializer org.bonitasoft.engine.EngineInitializer initializeEngine
信息: Exception while initializing the engine: org.bonitasoft.engine.platform.StartNodeException: Platform starting failed.
2016-04-21 14:17:52.289 +0800 org.bonitasoft.engine.api.internal.servlet.EngineInitializerListener org.bonitasoft.engine.api.internal.servlet.EngineInitializerListener contextInitialized
严重: Error while initializing the Engine
org.bonitasoft.engine.platform.StartNodeException: Platform starting failed.
at org.bonitasoft.engine.api.impl.PlatformAPIImpl.startNode(PlatformAPIImpl.java:250)
at org.bonitasoft.engine.PlatformTenantManager.updatePlatform(PlatformTenantManager.java:53)
at org.bonitasoft.engine.PlatformTenantManager.startPlatform(PlatformTenantManager.java:60)
at org.bonitasoft.engine.EngineInitializer.startPlatform(EngineInitializer.java:147)
at org.bonitasoft.engine.EngineInitializer.initializeEngine(EngineInitializer.java:101)
at org.bonitasoft.engine.api.internal.servlet.EngineInitializerListener.contextInitialized(EngineInitializerListener.java:42)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:677)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1939)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.bonitasoft.engine.execution.work.RestartException: unable to flag elements as to be restarted
at org.bonitasoft.engine.execution.work.RestartFlowNodesHandler.beforeServicesStart(RestartFlowNodesHandler.java:65)
at org.bonitasoft.engine.api.impl.PlatformAPIImpl$2.call(PlatformAPIImpl.java:503)
at org.bonitasoft.engine.api.impl.PlatformAPIImpl$2.call(PlatformAPIImpl.java:499)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:312)
at org.bonitasoft.engine.api.impl.PlatformAPIImpl.beforeServicesStartOfRestartHandlersOfTenant(PlatformAPIImpl.java:507)
at org.bonitasoft.engine.api.impl.PlatformAPIImpl.beforeServicesStartOfRestartHandlersOfTenant(PlatformAPIImpl.java:381)
at org.bonitasoft.engine.api.impl.PlatformAPIImpl.startNode(PlatformAPIImpl.java:232)
… 18 more
Caused by: org.bonitasoft.engine.persistence.SBonitaReadException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.bonitasoft.engine.persistence.AbstractHibernatePersistenceService.selectList(AbstractHibernatePersistenceService.java:721)
at org.bonitasoft.engine.core.process.instance.impl.FlowNodeInstancesServiceImpl.getFlowNodeInstanceIdsToRestart(FlowNodeInstancesServiceImpl.java:501)
at org.bonitasoft.engine.execution.work.RestartFlowNodesHandler.beforeServicesStart(RestartFlowNodesHandler.java:58)
… 24 more
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:88)
at org.hibernate.loader.Loader.getResultSet(Loader.java:2062)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1859)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838)
at org.hibernate.loader.Loader.doQuery(Loader.java:906)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348)
at org.hibernate.loader.Loader.doList(Loader.java:2550)
at org.hibernate.loader.Loader.doList(Loader.java:2536)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2366)
at org.hibernate.loader.Loader.list(Loader.java:2361)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:495)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:357)
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:198)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1194)
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
at org.bonitasoft.engine.persistence.AbstractHibernatePersistenceService.selectList(AbstractHibernatePersistenceService.java:713)
… 26 more
Caused by: org.postgresql.util.PSQLException: 错误: 操作符不存在: boolean = integer
建议:没有匹配指定名称和参数类型的操作符. 您也许需要增加明确的类型转换.
位置:138
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:304)
at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection$StatementHandler.invoke(AbstractJdbc23PooledConnection.java:453)
at com.sun.proxy.$Proxy3.executeQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at bitronix.tm.resource.jdbc.BaseProxyHandlerClass.invoke(BaseProxyHandlerClass.java:64)
at com.sun.proxy.$Proxy8.executeQuery(Unknown Source)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:79)
… 41 more

2016-04-21 14:17:52.367 +0800 org.bonitasoft.console.common.server.servlet.PlatformTenantListener org.bonitasoft.console.common.server.servlet.PlatformTenantListener contextInitialized
严重: Error while initializing the default tenant
org.bonitasoft.engine.platform.NodeNotStartedException: The current node has not been started yet. Method PlatformAPI.startNode() must be called previously.
at org.bonitasoft.engine.api.impl.ServerAPIImpl.checkMethodAccessibility(ServerAPIImpl.java:287)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIOutsideTransaction(ServerAPIImpl.java:278)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:270)
at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:124)
at org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:86)
at com.sun.proxy.$Proxy32.login(Unknown Source)
at org.bonitasoft.console.common.server.servlet.PlatformTenantListener.initializeDefaultTenant(PlatformTenantListener.java:61)
at org.bonitasoft.console.common.server.servlet.PlatformTenantListener.contextInitialized(PlatformTenantListener.java:44)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:677)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1939)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

My mistake…did not change DB_OPTS and BDM_DB_OPTS to postgresql in setenv.sh