Fórum

Implementing Transaction

thumbnail
Sreejesh Pv, modificado 11 Anos atrás.

Implementing Transaction

Junior Member Postagens: 41 Data de Entrada: 27/11/12 Postagens Recentes
I have one Class which extends MVCPortlet

In that I am calling two methods of Service layer
1.MACLocalServiceUtil.addMAC(mac);
2.MSGRCPTLocalServiceUtil.addMSGRCPT(rcpt);

If there is some issue/exception while inserting/adding the second add method the entire transaction should roll back.
Is there any simple way to implement this in liferay.
like
setAutocommit(false) then call this methods

1.MACLocalServiceUtil.addMAC(mac);
2.MSGRCPTLocalServiceUtil.addMSGRCPT(rcpt);

if any exception
rollback

if no exception
commit