<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic runtimeService.getVariables requires a ReadW in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/runtimeservice-getvariables-requires-a-readw/m-p/198318#M151448</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@Transactional(readOnly = true, propagation = Propagation.REQUIRED)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in&amp;nbsp; advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;StackTrace:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR:&amp;nbsp; cannot execute UPDATE in a read-only transaction&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[postgres error] STATEMENT:&amp;nbsp; update ACT_GE_BYTEARRAY &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[postgres error] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[postgres error] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REV_ = $1,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[postgres error] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BYTES_ = $2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[postgres error] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where ID_ = $3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[postgres error] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and REV_ = $4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[postgres error] 2015-10-20 10:28:29,077 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - &amp;lt;SQL Error: 0, SQLState: 25006&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2015-10-20 10:28:29,077 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - &amp;lt;ERROR: cannot execute UPDATE in a read-only transaction&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2015-10-20 10:28:29,079 ERROR [org.activiti.engine.impl.interceptor.CommandContext] - &amp;lt;Error while closing command context&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;org.apache.ibatis.exceptions.PersistenceException: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;### Error updating database.&amp;nbsp; Cause: org.hibernate.exception.GenericJDBCException: ERROR: cannot execute UPDATE in a read-only transaction&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;### The error may involve org.activiti.engine.impl.persistence.entity.ByteArrayEntity.updateByteArray_postgres-Inline&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;### The error occurred while setting parameters&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;### SQL: update ACT_GE_BYTEARRAY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; REV_ = ?,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BYTES_ = ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where ID_ = ?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and REV_ = ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;### Cause: org.hibernate.exception.GenericJDBCException: ERROR: cannot execute UPDATE in a read-only transaction&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:150)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:560)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:444)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:170)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:117)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.RuntimeServiceImpl.getVariables(RuntimeServiceImpl.java:108)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Oct 2015 10:18:10 GMT</pubDate>
    <dc:creator>billy_mcdonagh</dc:creator>
    <dc:date>2015-10-20T10:18:10Z</dc:date>
    <item>
      <title>runtimeService.getVariables requires a ReadW</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/runtimeservice-getvariables-requires-a-readw/m-p/198318#M151448</link>
      <description>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 RuntimeServic</description>
      <pubDate>Tue, 20 Oct 2015 10:18:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/runtimeservice-getvariables-requires-a-readw/m-p/198318#M151448</guid>
      <dc:creator>billy_mcdonagh</dc:creator>
      <dc:date>2015-10-20T10:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: runtimeService.getVariables requires a ReadW</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/runtimeservice-getvariables-requires-a-readw/m-p/198319#M151449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No, the getVariables() should do any update. But the fact it's a byteArray … could it be you have Serialized java objects as variables? That might explain it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Out of curiosity: whats the use for demarcating your transactions so strictly?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Oct 2015 17:31:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/runtimeservice-getvariables-requires-a-readw/m-p/198319#M151449</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2015-10-20T17:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: runtimeService.getVariables requires a ReadW</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/runtimeservice-getvariables-requires-a-readw/m-p/198320#M151450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your quick response &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes we do have Java objects as variables so this makes sense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Probably a silly question but what updates would activity be flushing for a call to getVariables()?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason we have the transactions so strict is because according to the Spring Documentation (&lt;/SPAN&gt;&lt;A href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/transaction.html#transaction-strategies" rel="nofollow noopener noreferrer"&gt;http://docs.spring.io/spring/docs/current/spring-framework-reference/html/transaction.html#transaction-strategies&lt;/A&gt;&lt;SPAN&gt;) if using Hibernate setting a transaction as read-only allows it to do some optimisation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;….&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Read-only status: A read-only transaction can be used when your code reads but does not modify data. Read-only transactions can be a useful optimization in some cases, such as when you are using Hibernate. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;…..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also it is useful if another developer wrongly modifies a service method that is understood to only perform readonly actions. If marked as readonly an exception will be thrown which will hopefully highlight the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Billy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Oct 2015 09:15:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/runtimeservice-getvariables-requires-a-readw/m-p/198320#M151450</guid>
      <dc:creator>billy_mcdonagh</dc:creator>
      <dc:date>2015-10-22T09:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: runtimeService.getVariables requires a ReadW</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/runtimeservice-getvariables-requires-a-readw/m-p/198321#M151451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&amp;gt; Probably a silly question but what updates would activity be flushing for a call to getVariables()?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not a silly question, I was pondering about that myself &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; I guess for Java object serialization some 'touching' is going on, even if it's just a 'get'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, thanks for the readonly explanation. I've never saw it being used in practice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2015 18:50:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/runtimeservice-getvariables-requires-a-readw/m-p/198321#M151451</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2015-10-28T18:50:04Z</dc:date>
    </item>
  </channel>
</rss>

