掲示板

Liferay transactions

thumbnail
12年前 に Kevin Gebel によって更新されました。

Liferay transactions

Junior Member 投稿: 80 参加年月日: 10/05/27 最新の投稿
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
12年前 に jelmer kuperus によって更新されました。

RE: Liferay transactions

Liferay Legend 投稿: 1191 参加年月日: 10/03/10 最新の投稿
If you use the community issue, it does not include the fix for http://issues.liferay.com/browse/LPS-14475
thumbnail
12年前 に Kevin Gebel によって更新されました。

RE: Liferay transactions

Junior Member 投稿: 80 参加年月日: 10/05/27 最新の投稿
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
12年前 に jelmer kuperus によって更新されました。

RE: Liferay transactions

Liferay Legend 投稿: 1191 参加年月日: 10/03/10 最新の投稿
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
12年前 に Kevin Gebel によって更新されました。

RE: Liferay transactions

Junior Member 投稿: 80 参加年月日: 10/05/27 最新の投稿
Ok. Thank you for your expertise Jelmer ;)
11年前 に Federico Miralles によって更新されました。

RE: Liferay transactions

New Member 投稿: 4 参加年月日: 12/09/20 最新の投稿
Hi Kevin,

You could check:

Liferay Transactional Custom Services Made Easy

Federico Miralles @Rotterdam CS BV