Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Matt S.
save current user in service builder
4 marzo 2013 12.21
Risposta

Matt S.

Punteggio: Junior Member

Messaggi: 36

Data di Iscrizione: 29 novembre 2012

Messaggi recenti

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
4 marzo 2013 14.10
Risposta

Hitoshi Ozawa

Punteggio: Liferay Legend

Messaggi: 7949

Data di Iscrizione: 23 marzo 2010

Messaggi recenti

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
5 marzo 2013 1.46
Risposta

Matt S.

Punteggio: Junior Member

Messaggi: 36

Data di Iscrizione: 29 novembre 2012

Messaggi recenti

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
7 marzo 2013 7.29
Risposta

Matt S.

Punteggio: Junior Member

Messaggi: 36

Data di Iscrizione: 29 novembre 2012

Messaggi recenti

Please can you help me?
Sandeep Nair
RE: save current user in service builder
7 marzo 2013 7.46
Risposta

Sandeep Nair

Punteggio: Liferay Legend

Messaggi: 1721

Data di Iscrizione: 5 novembre 2008

Messaggi recenti

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