Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
master slave
Extending liferay users in an other database
April 21, 2013 2:17 PM
Answer

master slave

Rank: Junior Member

Posts: 31

Join Date: April 8, 2013

Recent Posts

Hi community ,

Please i realy need your help because i spent a lot of time trying to solve this problem .

I would like to develop several portlets that add students and teachers,main informations of student should be in table users_ of liferay, and add more fields in a custom Students table.
I followed this tutorial Herebut I do not understand how liferay is doing the joint between the users_ table and extension table (column :email)
1Now that we have added addUser to our new class, when our class is called it will add a user to the liferay user table as well as our extra fields to our new table, and they will be linked via the e-mail address.
.
Can someone help me to do this task.

I will be very grateful.
Sunil Kulkarni
RE: Extending liferay users in an other database
April 22, 2013 12:02 AM
Answer

Sunil Kulkarni

Rank: Junior Member

Posts: 94

Join Date: June 24, 2011

Recent Posts

Hello,

LR does not support one-to-one mapping between 2 tables (joins) directly with Service Builder.

In one of my earlier assignment, I did the following. In my case I have used use id to map the data between 2 tables.

User_ table - LR table (userid - unique id)
UserExt table - Create by Me (userId -PK for my table).

1. Written a addUser method in my class.
2. Get the parameter required for adding user in LR and more parameters for populating the data in my table (UserExt).
3. Add a user in LR table usinf UserServiceUtil.addUser() method. Return type of this method is User model.
4. User User.userId from LR and also populate the data in UserExt table with User.userId as PK. So that when I get userId, I am able to get the information from both the tables with one unique key.
master slave
RE: Extending liferay users in an other database
April 22, 2013 2:39 PM
Answer

master slave

Rank: Junior Member

Posts: 31

Join Date: April 8, 2013

Recent Posts

Thank you emoticon
Do you know how to get the current userId that is inserted into database?because i need to add it in the UserExta Table
Manish Yadav
RE: Extending liferay users in an other database
April 22, 2013 11:55 PM
Answer

Manish Yadav

Rank: Expert

Posts: 384

Join Date: May 26, 2012

Recent Posts

did you create any custom portlet for adding user in portal or you are using OTB portlet..
If OTB then you can create EXT ..
from com.liferay.portlet.login.action.CreateAccountAction.java you can get

long userId=User.getUserid();
master slave
RE: Extending liferay users in an other database
April 23, 2013 2:52 AM
Answer

master slave

Rank: Junior Member

Posts: 31

Join Date: April 8, 2013

Recent Posts

I have created a custom portlet that add user in user_ table and other fields in an other table userExtra.Any solution for this issue ?
master slave
RE: Extending liferay users in an other database
April 23, 2013 4:49 PM
Answer

master slave

Rank: Junior Member

Posts: 31

Join Date: April 8, 2013

Recent Posts

SOLVED: UserLocalServiceUtil.addUser(...) return a User Object and from this object i got the last userId inserted in user_ table.

Thanks for your reply