フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Kevin Gebel
Liferay transactions
2011/11/18 8:24
答え

Kevin Gebel

ランク: Junior Member

投稿: 80

参加年月日: 2010/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 :

 1try
 2{
 3[indent]ContactLocalServiceUtil.updateContact(cloneUserLiferay.getContact());[/indent]
 4[indent]UserLocalServiceUtil.updateUser(cloneUserLiferay);[/indent]
 5[indent]if (1 == 1) throw new NullPointerException();[/indent]
 6}
 7catch (Exception e)
 8{
 9
10}


This code is from a portlet. Data are never rollbacked.
Jelmer Kuperus
RE: Liferay transactions
2011/11/18 16:08
答え

Jelmer Kuperus

ランク: Liferay Legend

投稿: 1190

参加年月日: 2010/03/10

最近の投稿

If you use the community issue, it does not include the fix for http://issues.liferay.com/browse/LPS-14475
Kevin Gebel
RE: Liferay transactions
2011/11/21 0:57
答え

Kevin Gebel

ランク: Junior Member

投稿: 80

参加年月日: 2010/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 ?
Jelmer Kuperus
RE: Liferay transactions
2011/11/21 1:29
答え

Jelmer Kuperus

ランク: Liferay Legend

投稿: 1190

参加年月日: 2010/03/10

最近の投稿

The transactional boundry is defined on the service

So if you do :

1ContactLocalServiceUtil.updateContact(cloneUserLiferay.getContact());
2UserLocalServiceUtil.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
RE: Liferay transactions
2011/11/21 1:38
答え

Kevin Gebel

ランク: Junior Member

投稿: 80

参加年月日: 2010/05/27

最近の投稿

Ok. Thank you for your expertise Jelmer ;)
Federico Miralles
RE: Liferay transactions
2013/03/18 6:28
答え

Federico Miralles

ランク: New Member

投稿: 7

参加年月日: 2012/09/20

最近の投稿

Hi Kevin,

You could check:

Liferay Transactional Custom Services Made Easy

Federico Miralles @Rotterdam CS BV