AnsweredAssumed Answered

runtimeService.getVariables requires a ReadW

Question asked by billy.mcdonagh on Oct 20, 2015
Latest reply on Oct 22, 2015 by billy.mcdonagh
Hi, I'm using Activiti 5.1.4 with Spring 4.1.5.RELEASE and Hibernate 4.1.9.Final and I'm getting the following issue 'cannot execute UPDATE in a read-only transaction' (stacktrace below) when calling the RuntimeService.getVariables() method. My service method containing the call to the RuntimeService is annotated with the following:

@Transactional(readOnly = true, propagation = Propagation.REQUIRED)

If the readOnly attribute is changed to readOnly=false so it creates a read write transaction, the call to RuntimeService.getVariables() works fine. Is this the expected behaviour that updates are flushed even for a readonly call such as getVariables?
Thanks in  advance.


ERROR:  cannot execute UPDATE in a read-only transaction
[postgres error] STATEMENT:  update ACT_GE_BYTEARRAY
[postgres error]        set
[postgres error]          REV_ = $1,
[postgres error]          BYTES_ = $2
[postgres error]        where ID_ = $3
[postgres error]          and REV_ = $4
[postgres error] 2015-10-20 10:28:29,077 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - <SQL Error: 0, SQLState: 25006>
2015-10-20 10:28:29,077 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - <ERROR: cannot execute UPDATE in a read-only transaction>
2015-10-20 10:28:29,079 ERROR [org.activiti.engine.impl.interceptor.CommandContext] - <Error while closing command context>
### Error updating database.  Cause: org.hibernate.exception.GenericJDBCException: ERROR: cannot execute UPDATE in a read-only transaction
### The error may involve org.activiti.engine.impl.persistence.entity.ByteArrayEntity.updateByteArray_postgres-Inline
### The error occurred while setting parameters
### SQL: update ACT_GE_BYTEARRAY      set       REV_ = ?,       BYTES_ = ?     where ID_ = ?       and REV_ = ?
### Cause: org.hibernate.exception.GenericJDBCException: ERROR: cannot execute UPDATE in a read-only transaction
   at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(
   at org.apache.ibatis.session.defaults.DefaultSqlSession.update(
   at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(
   at org.activiti.engine.impl.db.DbSqlSession.flush(
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(
   at org.activiti.engine.impl.interceptor.CommandContext.close(
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(
   at org.activiti.spring.SpringTransactionInterceptor.execute(
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(
   at org.activiti.engine.impl.RuntimeServiceImpl.getVariables(