Rollback transaction in Javascript back-end Web Script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2010 03:29 AM
Hello,
I would like to rollback transaction inside a JavaScript back-end WebScript
Currently, I can't manage to do this. Transaction are only roll-backed when a error occurs during execution of JavaScript (like reading value from a null object) or when a Freemarker rendering occurs.
If I put
I would like to have such a thing in order to specialize code and error message and have ability to perform rollback on demand.
Should I use the transactionService ??? Wiki only says this
I would like to rollback transaction inside a JavaScript back-end WebScript
Currently, I can't manage to do this. Transaction are only roll-backed when a error occurs during execution of JavaScript (like reading value from a null object) or when a Freemarker rendering occurs.
If I put
status.code = 500;status.message = "I wan't to rollback";status.redirect =true;
Error message is displayed but transaction is not rollback.I would like to have such a thing in order to specialize code and error message and have ability to perform rollback on demand.
Should I use the transactionService ??? Wiki only says this
Extreme care must be taken when using certain Alfresco APIs, for example the transaction APIs. This is because in many cases the Alfresco scripting framework includes logic that handles some of these "plumbing" concerns automatically - for example the Javascript script for a Web Script is automatically executed within an Alfresco transaction - programmatic transaction handling within the Javascript is not required and may interfere with the default behaviour.
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2011 11:12 AM
You should implement a Java-Backed WebScripts configuring the descriptor with <transaction>none</transaction> and using inside in the Java implementation the RetryingTransactionHelper as you can see in the FirstFoundationClient that you find as an example in the Alfresco SDK. In this way you can decide when the rollback must be triggered.
Hope this helps.
Hope this helps.
