AnsweredAssumed Answered

PersistenceException with Postgres

Question asked by marfago on Jul 12, 2012
Latest reply on Jul 13, 2012 by marfago
Hi,

I've set up a web app using Activiti Engine and Postgres. Initially I was using H2 db just for testing purpose and all was working fine, then I moved to Postgres.
In short, when I try to search for comments I get this error:


org.apache.ibatis.exceptions.PersistenceException: <|### Error querying database.  Cause: org.postgresql.util.PSQLExcept
ion: ERROR: operator does not exist: character varying = bytea<|### The error may involve org.activiti.engine.impl.persi
stence.entity.CommentEntity.selectCommentsByProcessInstanceId_postgres-Inline<|### The error occurred while setting para
meters<|### Cause: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = bytea
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:81)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:73)
        at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:182)
        at org.activiti.engine.impl.persistence.entity.CommentManager.findCommentsByProcessInstanceId(CommentManager.jav
a:59)
        at org.activiti.engine.impl.cmd.GetProcessInstanceCommentsCmd.execute(GetProcessInstanceCommentsCmd.java:38)
        at org.activiti.engine.impl.cmd.GetProcessInstanceCommentsCmd.execute(GetProcessInstanceCommentsCmd.java:27)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.activiti.engine.impl.TaskServiceImpl.getProcessInstanceComments(TaskServiceImpl.java:234)
        ………………………

Caused by:
org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = bytea
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1608)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1343)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:194)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:470)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:369)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:362)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:39)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:55)
        at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:41)
        at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:243)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:117)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:72)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:79)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:73)
        at org.activiti.engine.impl.db.DbSqlSession.selectList(DbSqlSession.java:182)
        at org.activiti.engine.impl.persistence.entity.CommentManager.findCommentsByProcessInstanceId(CommentManager.jav
a:59)
        at org.activiti.engine.impl.cmd.GetProcessInstanceCommentsCmd.execute(GetProcessInstanceCommentsCmd.java:38)
        at org.activiti.engine.impl.cmd.GetProcessInstanceCommentsCmd.execute(GetProcessInstanceCommentsCmd.java:27)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.activiti.engine.impl.TaskServiceImpl.getProcessInstanceComments(TaskServiceImpl.java:234)

I'v tried with 8.3-606.jdbc4 and PostgreS 8.3 and 9.1 but nothing changed.
Any clue?
M@rco

Here my conf:

database.url = jdbc:postgresql://localhost:5432
database.driver = org.postgresql.Driver
database.username = postgres
database.password = postgres
database.showSql = true
database.generateDdl = false
database.target=POSTGRESQL

And in spring conf:

<bean id="entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
      <property name="persistenceUnitName" value="pu" />
      <property name="dataSource" ref="dataSource" />
      <property name="jpaVendorAdapter">
         <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
            <property name="database" value="${database.target}"/>
            <property name="showSql" value="${database.showSql}" />
            <property name="generateDdl" value="${database.generateDdl}" />
         </bean>
      </property>
   </bean>

   <bean id="dataSource"
      class="org.springframework.jdbc.datasource.DriverManagerDataSource">
      <property name="driverClassName" value="${database.driver}" />
      <property name="url" value="${database.url}" />
      <property name="username" value="${database.username}" />
      <property name="password" value="${database.password}" />
   </bean>

Outcomes