论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Matt S.
save current user in service builder
2013年3月4日 下午12:21
答复

Matt S.

等级: Junior Member

帖子: 36

加入日期: 2012年11月29日

最近的帖子

Hi all,

I have a problem with service builder, in particular i need to save the current user in it. I've created a string column in service builder and I use this code for saving current user...

1
2User utente=PortalUtil.getUser(req);
3String user=utente.getScreenName();
4EventoLocalServiceUtil.addEvents(name, city, price, start_d,end_d, category, description,user);


At the beginning this code works, infact I can retrieve the current user name, but when I restart the server in place of user name appear SA.

How can I solve this problem?

Regards
Hitoshi Ozawa
RE: save current user in service builder
2013年3月4日 下午2:10
答复

Hitoshi Ozawa

等级: Liferay Legend

帖子: 7949

加入日期: 2010年3月23日

最近的帖子

Not at all sure what you're doing. How are you using service builder? Did you create "Evento" service or modified liferay's user?
Where are putting this code?
Matt S.
RE: save current user in service builder
2013年3月5日 上午1:46
答复

Matt S.

等级: Junior Member

帖子: 36

加入日期: 2012年11月29日

最近的帖子

Hi Hitoshi,

yes I've created a service bulder with entity called Evento where i put some column, like name city price, and a column called user of String type where I want save the current user name. Then I've created a class with logic to manipulate entity in which i've put the code posted by me. At the beginning works but when i restart the server it doesn't work, and instead of user name it retrieve me "SA". Where is the problem?
Matt S.
RE: save current user in service builder
2013年3月7日 上午7:29
答复

Matt S.

等级: Junior Member

帖子: 36

加入日期: 2012年11月29日

最近的帖子

Please can you help me?
Sandeep Nair
RE: save current user in service builder
2013年3月7日 上午7:46
答复

Sandeep Nair

等级: Liferay Legend

帖子: 1694

加入日期: 2008年11月5日

最近的帖子

Is it possible for you to paste the code of eventolocalserviceimpl. I believe the problem may be that you might be using one of those methods that creates an entity but does not put in the database. Like there is a "createEntity" method which does not insert into database and there is "addEntity" method which creates and persists the value in db. I feel may be you are using the former method.

Regards,
Sandeep