Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
adding prefix programatically/api
January 9, 2013 8:24 AM


Rank: Junior Member

Posts: 65

Join Date: August 6, 2012

Recent Posts

Hi All,
I am trying to create a user registrtion which is happening correctly using liferay out of the box jsf register portlet.
I am planning to add prefix using liferay api ,here is the version i am using liferay-portal-6.1.0-ce-ga1.war

here is the sql i found but i am planning to use using api/programatically,please suggest
insert into ListType (listTypeId, name, type_) values (11018, 'Doctor', 'com.liferay.portal.model.Contact.prefix');
i guess i have to use ListTypeServiceUtil but not sure.

Thanks in Advance.
Neil Griffin
RE: adding prefix programatically/api
January 9, 2013 8:40 AM

Neil Griffin


Rank: Liferay Legend

Posts: 2511

Join Date: July 26, 2005

Recent Posts

I would recommend that you always use the Liferay service layer API to perform database operations. Executing SQL can be problematic, especially with INSERT statements because Liferay's internal CounterService is in full control of the generation of unique-identifiers / primary-keys.

Having said that, it looks like the ListTypeServiceUtil does not have any "add" methods inside it, so my recommendation would be that you define your own service.xml and use ServiceBuilder to create your own table in the database. ServiceBuilder will auto-generate service-layer CRUD methods for all of your database operations.

You could also try the Dynamic Data Lists feature of Liferay 6.1, but Liferay Faces does not currently have any Facelet tags that will show the lists. You would have to get the lists from the service layer after you have defined them.

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!