Foros de discusión

Liferay transactions

thumbnail
Kevin Gebel, modificado hace 12 años.

Liferay transactions

Junior Member Mensajes: 80 Fecha de incorporación: 27/05/10 Mensajes recientes
Hello

I have been turning around for days so, please, I really need help !
I try to rollback when exception occurs (create a transaction) when I call the following services :

try
{
[indent]ContactLocalServiceUtil.updateContact(cloneUserLiferay.getContact());[/indent]
[indent]UserLocalServiceUtil.updateUser(cloneUserLiferay);[/indent]
[indent]if (1 == 1) throw new NullPointerException();[/indent]
}
catch (Exception e)
{

}


This code is from a portlet. Data are never rollbacked.
thumbnail
jelmer kuperus, modificado hace 12 años.

RE: Liferay transactions

Liferay Legend Mensajes: 1191 Fecha de incorporación: 10/03/10 Mensajes recientes
If you use the community issue, it does not include the fix for http://issues.liferay.com/browse/LPS-14475
thumbnail
Kevin Gebel, modificado hace 12 años.

RE: Liferay transactions

Junior Member Mensajes: 80 Fecha de incorporación: 27/05/10 Mensajes recientes
Thank you.

In a normal way, how should I manage a transaction here ?
Will the fix be available in 6.1 version of the portal ?
thumbnail
jelmer kuperus, modificado hace 12 años.

RE: Liferay transactions

Liferay Legend Mensajes: 1191 Fecha de incorporación: 10/03/10 Mensajes recientes
The transactional boundry is defined on the service

So if you do :

ContactLocalServiceUtil.updateContact(cloneUserLiferay.getContact());
UserLocalServiceUtil.updateUser(cloneUserLiferay);


Those will be two transactions. To make them run within a single transaction you would have to use service builder to generate an "empty" service on which you define a method that wraps the two service calls

And yes, that issue should be solved in liferay 6.1
thumbnail
Kevin Gebel, modificado hace 12 años.

RE: Liferay transactions

Junior Member Mensajes: 80 Fecha de incorporación: 27/05/10 Mensajes recientes
Ok. Thank you for your expertise Jelmer ;)
Federico Miralles, modificado hace 11 años.

RE: Liferay transactions

New Member Mensajes: 4 Fecha de incorporación: 20/09/12 Mensajes recientes
Hi Kevin,

You could check:

Liferay Transactional Custom Services Made Easy

Federico Miralles @Rotterdam CS BV