Message Boards

« Back to 2.- Usage ( From Xml file to CRUD Portlet)

RE: Insert values into table via API

Combination View Flat View Tree View
Threads [ Previous | Next ]
Insert values into table via API
11/5/15 9:51 AM
Hi, I'm Ricardo from Spain.

I'm trying to use the code generated by xmlportletfactory to insert values into the tables in a migration process.

Im using this code with the *LocalServiceUtil generated by the xmlportletfactory:

 2Translations translations = TranslationsLocalServiceUtil.createTranslations(idTranslation);

My question is regarding the id for the table.

There is a way to get the next id I have to use using the API?
Is this the right way to insert values via API?

Thanks in advance and sorry for my bad english.

RE: Insert values into table via API
11/16/15 8:11 AM as a reply to RICARDO GARCIA HERNANZ.
Hola Ricardo,

there is a better API for adding entities. Search TranslationsLocalServiceUtil.for addTranslations, there the numeric identifier will be created for you automatically.