07-11-2014 07:37 AM
<transaction>required</transaction>
UserTransaction trx = serviceRegistry.getTransactionService().getUserTransaction(false);
try {
trx.begin();
Alfresco OPERATION 1
Alfresco OPERATION 2
trx.commit();
} catch(Throwable e) {
trx.rollback();
…
}
UserTransaction trx = serviceRegistry.getTransactionService().getUserTransaction(false);
try {
trx.begin();
Alfresco OPERATION 3
Alfresco OPERATION 4
trx.commit();
} catch(Throwable e) {
trx.rollback();
…
}
07-11-2014 11:51 AM
UserTransaction trx = serviceRegistry.getTransactionService().getUserTransaction(false);
,It will use existing transaction(your webscript transaction ) instead of creating new one .
UserTransaction trx = serviceRegistry.getTransactionService().getNonPropagatingUserTransaction(false);
try {
trx.begin();
Alfresco OPERATION 1
Alfresco OPERATION 2
trx.commit();
} catch(Throwable e) {
trx.rollback();
…
}
UserTransaction trx = serviceRegistry.getTransactionService().getNonPropagatingUserTransaction(false);
try {
trx.begin();
Alfresco OPERATION 3
Alfresco OPERATION 4
trx.commit();
} catch(Throwable e) {
trx.rollback();
…
}
07-14-2014 01:45 AM
07-14-2014 09:46 AM
getUserTransaction
and getNonPropagatingUserTransaction
will work differently:getUserTransaction
will use the existiong transaction that webscript framework created ,so all your code in Alfresco OPERATION 1,Alfresco OPERATION 2,Alfresco OPERATION 3, Alfresco OPERATION 4
all execute in the same transaction ,any exceptions throwed in Alfresco OPERATION 1 to Alfresco OPERATION 4 will cause the whole transaction rollback.getNonPropagatingUserTransaction
will create a new transaction , Alfresco OPERATION 1 and Alfresco OPERATION 2
will execute in a second transaction that is different from webscript transaction which can be commited and rollback separately, Alfresco OPERATION 3 and Alfresco OPERATION 4
will run in the third transaction getUserTransaction
and getNonPropagatingUserTransaction
will work the same ,both will create a new transaction for their own.
Alfresco OPERATION 1
Alfresco OPERATION 2
,it will also cause your webscript transaction rollback,which might be not what you need.07-23-2014 01:55 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.