Fórum

How to insert data in User table through own portlet ??

piyush liferay, modificado 11 Anos atrás.

How to insert data in User table through own portlet ??

Junior Member Postagens: 40 Data de Entrada: 02/01/13 Postagens Recentes
Hello ,

How to insert data in User table which is already present in liferay..

can you suggest me best solution for that...
Siby Mathew, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Expert Postagens: 268 Data de Entrada: 04/03/11 Postagens Recentes
Use methods from UserLocalServiceUtil.java like addUser, updateUser etc.

Thanks,
Siby
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Use UserLocalServiceImpl.addUser

http://docs.liferay.com/portal/6.1/javadocs-all/com/liferay/portal/service/impl/UserLocalServiceImpl.html

OR

UserLocalServiceUtil.AddUser

http://docs.liferay.com/portal/6.1/javadocs/com/liferay/portal/service/UserLocalServiceUtil.html
piyush liferay, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Junior Member Postagens: 40 Data de Entrada: 02/01/13 Postagens Recentes
Hitoshi Ozawa:
Use UserLocalServiceImpl.addUser

http://docs.liferay.com/portal/6.1/javadocs-all/com/liferay/portal/service/impl/UserLocalServiceImpl.html

OR

UserLocalServiceUtil.AddUser

http://docs.liferay.com/portal/6.1/javadocs/com/liferay/portal/service/UserLocalServiceUtil.html


Liferay User Class contain some of few fields but i have more fields so i have to insert some field in User Class and Some Field in Own Class..

so how to insert such entries in both the User and Own class.

Thanks..
thumbnail
Jitendra Rajput, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Liferay Master Postagens: 875 Data de Entrada: 07/01/11 Postagens Recentes
For the extra fields you can create custom fields .
http://www.liferay.com/community/wiki/-/wiki/Main/Custom+fields
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
For you own fields, just use expando

http://www.liferay.com/community/wiki/-/wiki/Main/Developing+with+Expando
piyush liferay, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Junior Member Postagens: 40 Data de Entrada: 02/01/13 Postagens Recentes
can we insert data without using expando ??
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
can we insert data without using expando ??


Insert data where? You need a database table column to enter data. Which column do you want to enter you data?
piyush liferay, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Junior Member Postagens: 40 Data de Entrada: 02/01/13 Postagens Recentes
i have column for inserting a data but not using expando..

i am inserting a data normally ..

can we insert data in database ??
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
have column for inserting a data but not using expando..


So, use your api to enter data into your column. I'm not sure what the problem is. If you created a column, creating a method to insert/change/delete data from that column is dependent on you code not liferay's.
piyush liferay, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Junior Member Postagens: 40 Data de Entrada: 02/01/13 Postagens Recentes
Hitoshi Ozawa:
have column for inserting a data but not using expando..


So, use your api to enter data into your column. I'm not sure what the problem is. If you created a column, creating a method to insert/change/delete data from that column is dependent on you code not liferay's.



Sir i write down my complete problem here ....

i have fileds like :-

name,email,password,mobileno,address etc.

but in User class contain only name,email and password field so i want to insert mobileno and address field in my class Register

so give me the solution for that problem... but i am not using a expando.
Siby Mathew, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Expert Postagens: 268 Data de Entrada: 04/03/11 Postagens Recentes
Hi Piyush,
The easiest way to achieve this is to store it in the expando.
But if you really want another table, use servicebuilder to generate a new table. All the CRUD operations will be autogenerated by Liferay.
After inserting the user, you can use these APIs to update your custom table.

Thanks,
Siby
piyush liferay, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Junior Member Postagens: 40 Data de Entrada: 02/01/13 Postagens Recentes
but for inserting a user i want to require a userId which is autoincrement so how can i do ...
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: How to insert data in User table through own portlet ??

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
but for inserting a user i want to require a userId which is autoincrement so how can i do ...


The subject of this thread has nothing to do with the question you're asking now.
Close this thread and create a new thread with the question you've just asked - "How to modify liferay addUser method to autoincrement userId"
thumbnail
Bharamani P Tashildar, modificado 8 Anos atrás.

RE: How to insert data in User table through own portlet ??

Junior Member Postagens: 48 Data de Entrada: 27/08/14 Postagens Recentes
HI friends,,

The same problem i am facing...

for user_ there are two methods available that we can use

1.. UserLocalServiceUtil.addUser(user);
2..UserLocalServiceUtil.addUser(creatorUserId, companyId, autoPassword, password1, password2, autoScreenName, screenName,
emailAddress, facebookId, openId, locale, firstName, middleName, lastName, prefixId, suffixId, male,
birthdayMonth, birthdayDay, birthdayYear, getTitle(null), groupIds, organizationIds, roleIds,
userGroupIds, sendEmail, serviceContext);

Both i tried but no result plz help me to solve this..............

I have firstName ,lastName, password, emailId, role and autogenerated userId in my custom portlet......
I want to store it in User_table

Thanks & Regards
Bharamani Tashildar
thumbnail
Harish Kumar, modificado 8 Anos atrás.

RE: How to insert data in User table through own portlet ??

Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
Hi

Data should be saved in user_ table. Following is the code snippet you can try


user = UserLocalServiceUtil.addUser(themeDisplay.getUserId(),
					themeDisplay.getCompanyId(), false, password, password, false,
					screenName, email, 0L, StringPool.BLANK,
					themeDisplay.getLocale(), firstName, StringPool.BLANK, lastName, 0, 0,
					true, 1, 1, 1971, StringPool.BLANK,
					new long[] { themeDisplay.getScopeGroupId() },
					new long[] {}, new long[] {}, new long[] {}, false,
					serviceContext);
thumbnail
Bharamani P Tashildar, modificado 8 Anos atrás.

RE: How to insert data in User table through own portlet ??

Junior Member Postagens: 48 Data de Entrada: 27/08/14 Postagens Recentes
Thank s Harish Sir
Its working Fine