<?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 Re: Due date setting with Activiti 5.11 in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118687#M83712</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;They should have the same behavior if the code is executed sequentially and no other threads are doing something with the task at the same time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first code snippet will use the provided task, and check the revision of the task.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the revision doesn't match (ie an 'UPDATE … WHERE ID=x AND REV_=y' is done), nothing is updated and an optimistic locking exception has happened.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second snippet will always fetch the task from the database, thus ensuring the revision is always at the latest version.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Dec 2012 08:54:33 GMT</pubDate>
    <dc:creator>jbarrez</dc:creator>
    <dc:date>2012-12-26T08:54:33Z</dc:date>
    <item>
      <title>Due date setting with Activiti 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118681#M83706</link>
      <description>HelloWith Activiti 5.10 change due date was possible with the following 2 linestask.setDueDate(..)ProcessEngines.getDefaultProcessEngine().getTaskService().save(task)‍‍With Activiti 5.11 we have the following exception on the line 2 :Caused by: org.activiti.engine.ActivitiOptimisticLockingException:</description>
      <pubDate>Fri, 21 Dec 2012 12:36:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118681#M83706</guid>
      <dc:creator>maclab</dc:creator>
      <dc:date>2012-12-21T12:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Due date setting with Activiti 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118682#M83707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is a know limitation, your code is probably something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;Task task = taskService.createTaskQuery()….singleResult();&lt;BR /&gt;task.setPriority(1);&lt;BR /&gt;taskService.saveTask(task);&lt;BR /&gt;&lt;BR /&gt;task.setDueDate(..)&lt;BR /&gt;ProcessEngines.getDefaultProcessEngine().getTaskService().save(task)&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;The issue is, after the first saveTask, the internal "revision" isn't updated. So when saving again, the Database will have a different revision than the POJO that is still in memory. Solution for this is to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;Group your access to the setter-methods for the POJO and only save once&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Refetch (query) the task between individual saveTask() calls…&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2012 13:47:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118682#M83707</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2012-12-21T13:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Due date setting with Activiti 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118683#M83708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually, I fixed that in 5.11 Frederik. Before, we didn't properly do optimistic locking. The revision is now updated in the task object when it sucessfully updates in the database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So the only things that can go wrong here is that for some reason you have a task object with an older revision when you call the saveTask method.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2012 14:22:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118683#M83708</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2012-12-21T14:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Due date setting with Activiti 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118684#M83709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok thanks .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My pojo wasn't "refreshed".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What is difference between&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;task = taskService.createTaskQuery()…singleResult()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;task.setPriority(1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;taskService.save(task)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;task = taskService.createTaskQuery()…singleResult()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;taskService.setPriority(taskId, 1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is only the task pojo which is updated in the first case and not in the second ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2012 17:44:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118684#M83709</guid>
      <dc:creator>maclab</dc:creator>
      <dc:date>2012-12-21T17:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Due date setting with Activiti 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118685#M83710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry a little error in my request code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;task = taskService.createTaskQuery()…singleResult()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;task.setPriority(1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;taskService.save(task)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;task = taskService.createTaskQuery()…singleResult()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;taskService.setPriority(task.getId(), 1);&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2012 17:51:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118685#M83710</guid>
      <dc:creator>maclab</dc:creator>
      <dc:date>2012-12-21T17:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Due date setting with Activiti 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118686#M83711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would suspect them to have identical behaviour… Why the questuion? Don't they have the same behaviour?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Dec 2012 15:06:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118686#M83711</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2012-12-23T15:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Due date setting with Activiti 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118687#M83712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;They should have the same behavior if the code is executed sequentially and no other threads are doing something with the task at the same time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first code snippet will use the provided task, and check the revision of the task.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the revision doesn't match (ie an 'UPDATE … WHERE ID=x AND REV_=y' is done), nothing is updated and an optimistic locking exception has happened.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second snippet will always fetch the task from the database, thus ensuring the revision is always at the latest version.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2012 08:54:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118687#M83712</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2012-12-26T08:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Due date setting with Activiti 5.11</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118688#M83713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I verified your case with the following test:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;nbsp; public void testRevisionUpdatedOnSaveWhenFetchedUsingQuery() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Task task = taskService.newTask();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; taskService.saveTask(task);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assertEquals(1, ((TaskEntity) task).getRevision());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; task.setAssignee("kermit");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; taskService.saveTask(task);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assertEquals(2, ((TaskEntity) task).getRevision());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Now fetch the task through the query api&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; task = taskService.createTaskQuery().singleResult();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assertEquals(2, ((TaskEntity) task).getRevision());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; task.setPriority(1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; taskService.saveTask(task);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assertEquals(3, ((TaskEntity) task).getRevision());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; taskService.deleteTask(task.getId(), true);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;Which runs OK.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2012 09:27:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/due-date-setting-with-activiti-5-11/m-p/118688#M83713</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2012-12-26T09:27:43Z</dc:date>
    </item>
  </channel>
</rss>

