Forums de discussion
Liferay transactions
Kevin Gebel, modifié il y a 12 années.
Liferay transactions
Junior Member Publications: 80 Date d'inscription: 27/05/10 Publications récentes
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 :
This code is from a portlet. Data are never rollbacked.
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.
jelmer kuperus, modifié il y a 12 années.
RE: Liferay transactions
Liferay Legend Publications: 1191 Date d'inscription: 10/03/10 Publications récentes
If you use the community issue, it does not include the fix for http://issues.liferay.com/browse/LPS-14475
Kevin Gebel, modifié il y a 12 années.
RE: Liferay transactions
Junior Member Publications: 80 Date d'inscription: 27/05/10 Publications récentes
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 ?
In a normal way, how should I manage a transaction here ?
Will the fix be available in 6.1 version of the portal ?
jelmer kuperus, modifié il y a 12 années.
RE: Liferay transactions
Liferay Legend Publications: 1191 Date d'inscription: 10/03/10 Publications récentes
The transactional boundry is defined on the service
So if you do :
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
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
Kevin Gebel, modifié il y a 12 années.
RE: Liferay transactions
Junior Member Publications: 80 Date d'inscription: 27/05/10 Publications récentes
Ok. Thank you for your expertise Jelmer ;)
Federico Miralles, modifié il y a 11 années.
RE: Liferay transactions
New Member Publications: 4 Date d'inscription: 20/09/12 Publications récentes
Hi Kevin,
You could check:
Liferay Transactional Custom Services Made Easy
Federico Miralles @Rotterdam CS BV
You could check:
Liferay Transactional Custom Services Made Easy
Federico Miralles @Rotterdam CS BV