05-26-2014 10:24 AM
05-27-2014 07:29 AM
UserTransaction trx = serviceRegistry.getTransactionService().getNonPropagatingUserTransaction();
UserTransaction tx=serviceRegistry.getTransactionService().getUserTransaction();
05-27-2014 07:57 AM
05-27-2014 08:28 AM
UserTransaction tx=serviceRegistry.getTransactionService().getUserTransaction();
try {
trx.begin();
// all your code
trx.commit();
} catch(WebScriptException e) {
trx.rollback();
logger.error("ERROR: " + e);
throw new WebScriptException(Status.STATUS_PROPERTIES_ERROR, e.getMessage());
}
05-27-2014 10:43 AM
05-27-2014 08:37 AM
05-27-2014 10:41 AM
05-28-2014 02:47 AM
05-28-2014 06:46 AM
05-28-2014 07:52 AM
public NodeRef transactionCreateNode(NodeRef parent, Map<QName, Serializable> properties, String name) throws Exception {
NodeRef nodeRef = null;
UserTransaction trx = serviceRegistry.getTransactionService().getNonPropagatingUserTransaction();
try {
trx.begin();
nodeRef = this.createNode(parent, properties, name);
trx.commit();
} catch(Throwable e) {
trx.rollback();
logger.error("transactionCreateNode- ERROR: " + e);
throw new Exception(e);
}
return nodeRef;
}
public NodeRef transactionCreateNode(NodeRef parent, Map<QName, Serializable> properties, String name) throws Exception {
Boolean result = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Boolean>(){
public Boolean execute() throws Throwable {
boolean success= this.createNode(parent, properties, name);
if (!success)
throw new IllegalStateException("Error creating node");
return true;
}
}, false, true);
}
05-28-2014 08:33 AM
RetryingTransactionCallback<Object> txnWork = new RetryingTransactionCallback<Object>()
{
public Object execute() throws Exception
{
// Your code goes here
return result; //return null atleast if you have nothing to return to prevent compilation errors.
}
};
TransactionService transactionService = serviceRegistry.getTransactionService();
Object result = transactionService.getRetryingTransactionHelper().doInTransaction(txnWork, true);
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.