<?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 Transaction isn't rolled back in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/transaction-isn-t-rolled-back/m-p/78399#M24522</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Hello everyone,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt; I have this script that copies a file in Company Home and throws and exception after the copy throws and exception.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;function main(){&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;try{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var node = utils.getNodeFromString("workspace://SpacesStore/c9a77e78-2034-46ec-ae36-48049ee088d7");&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var nn = node.copy(companyhome);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw "exception";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}catch(e){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print(e.stack);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;status.setCode(status.STATUS_NOT_FOUND, e);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return null;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;main();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;I set the level of transaction to required, but the file is copied anyways.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;I have three questions:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Why is there not a rollback? &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;What am I doing wrong? &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;How can I tell Alfresco not to copy the file if there is an exception?&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ludovico&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Mar 2018 07:49:38 GMT</pubDate>
    <dc:creator>ajeje93</dc:creator>
    <dc:date>2018-03-30T07:49:38Z</dc:date>
    <item>
      <title>Transaction isn't rolled back</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/transaction-isn-t-rolled-back/m-p/78399#M24522</link>
      <description>Hello everyone, I have this script that copies a file in Company Home and throws and exception after the copy throws and exception.function main(){&amp;nbsp;&amp;nbsp;&amp;nbsp;try{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var node = utils.getNodeFromString("workspace://SpacesStore/c9a77e78-2034-46ec-ae36-48049ee088d7");&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var nn = node.copy(companyhome); &amp;nbsp;&amp;nbsp;</description>
      <pubDate>Fri, 30 Mar 2018 07:49:38 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/transaction-isn-t-rolled-back/m-p/78399#M24522</guid>
      <dc:creator>ajeje93</dc:creator>
      <dc:date>2018-03-30T07:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction isn't rolled back</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/transaction-isn-t-rolled-back/m-p/78400#M24523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try it using &lt;STRONG&gt;requiresnew.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Details are specified in below link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.alfresco.com/5.2/references/api-wsdl-transaction.html" title="https://docs.alfresco.com/5.2/references/api-wsdl-transaction.html" rel="nofollow noopener noreferrer"&gt;transaction | Alfresco Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2018 09:35:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/transaction-isn-t-rolled-back/m-p/78400#M24523</guid>
      <dc:creator>krutik_jayswal</dc:creator>
      <dc:date>2018-03-30T09:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction isn't rolled back</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/transaction-isn-t-rolled-back/m-p/78401#M24524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are throwing a JavaScript tier exception which is handled in the same script that it is thrown in.&amp;nbsp;Alfresco will only deal with any exceptions that cross an API boundary or bubble up to the top-level web script call. Since you are explicitely handling the exception without rethrowing it, there is no way for the retry logic to even be aware of the exception and handle it. By handling it yourself you are specifically saying "I got this - no need to run the default rollback".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want Alfresco to rollback the transaction, just make sure that any exceptions are propagated properly up the call chain. If you want a specific status code and message to be set, you'd have to use the Java WebScriptException class to tell the default handling what it should set in the response.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2018 10:48:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/transaction-isn-t-rolled-back/m-p/78401#M24524</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2018-03-30T10:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction isn't rolled back</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/transaction-isn-t-rolled-back/m-p/78402#M24525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for the explanation!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2018 14:20:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/transaction-isn-t-rolled-back/m-p/78402#M24525</guid>
      <dc:creator>ajeje93</dc:creator>
      <dc:date>2018-03-30T14:20:21Z</dc:date>
    </item>
  </channel>
</rss>

