Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
sasmita swain
fetch content from custom table
30. Januar 2013 20:42
Antwort

sasmita swain

Rang: Regular Member

Nachrichten: 185

Eintrittsdatum: 24. Februar 2012

Neue Beiträge

Hi all

In mu custom table i have stored id and 3 article ids just manualy..that article id is comming fron journal article table..i want to fetch content based on article id from my custom table

how to do?

Thanks

Sasmita
Chirag Patadia
RE: fetch content from custom table
30. Januar 2013 22:05
Antwort

Chirag Patadia

Rang: Junior Member

Nachrichten: 29

Eintrittsdatum: 2. Februar 2012

Neue Beiträge

Hi Sasmita,

Have you created custom table using service builder implementation in Liferay?

If yes, then you can create method in LocalServiceImpl file with custom logic to get records by articleId field from your custom table.
Jignesh Vachhani
RE: fetch content from custom table
30. Januar 2013 23:44
Antwort

Jignesh Vachhani

Rang: Liferay Master

Nachrichten: 780

Eintrittsdatum: 10. März 2008

Neue Beiträge

Does that table available in same DB ?
if yes, then you can create dummy service (using service builder) with the same entity name which you created in DB.
So you will get some auto generated finder methods and you can also write your finder to get data from DB table.
And then fetch one by one article id from custom table and use JournalArticleLocalServiceUtil class to fetch the content as per article id.
sasmita swain
RE: fetch content from custom table
31. Januar 2013 01:42
Antwort

sasmita swain

Rang: Regular Member

Nachrichten: 185

Eintrittsdatum: 24. Februar 2012

Neue Beiträge

Jignesh Vachhani:
Does that table available in same DB ?
if yes, then you can create dummy service (using service builder) with the same entity name which you created in DB.
So you will get some auto generated finder methods and you can also write your finder to get data from DB table.
And then fetch one by one article id from custom table and use JournalArticleLocalServiceUtil class to fetch the content as per article id.


Thanks for your reply

i have created by using service builder..i am getting content from journal article table..what should i write in finder method.
my attached service builder
can u give example for this?

Thanks

Sasmita
Anhänge: servicebuilder.txt (0,8k)
sasmita swain
RE: fetch content from custom table
31. Januar 2013 19:51
Antwort

sasmita swain

Rang: Regular Member

Nachrichten: 185

Eintrittsdatum: 24. Februar 2012

Neue Beiträge

Chirag Patadia:
Hi Sasmita,

Have you created custom table using service builder implementation in Liferay?

If yes, then you can create method in LocalServiceImpl file with custom logic to get records by articleId field from your custom table.



Thanks for your reply..but here i am getting articleid but how to getting content from this table?I have to retreive content from journal table based on article id which is created in custom table

Thanks

Sasmita
Anhänge: localserviceimpl.txt (0,2k)
Chirag Patadia
RE: fetch content from custom table
31. Januar 2013 23:18
Antwort

Chirag Patadia

Rang: Junior Member

Nachrichten: 29

Eintrittsdatum: 2. Februar 2012

Neue Beiträge

Hi Sasmita,

(1). If you wanted to fetch records from your custom table based on articleId field then:
First of all you need to add below finder tag in your service builder xml file and run build-service command.

<finder name="ArticleId" return-type="Collection">
<finder-column name="articleId" />
</finder>

Once you done with build-service command you can able to see finder method for articleId field in entity's persistence java file. Now next step is to create get/fetch method, for that you can open LocalServiceImpl java file and add the function which you have added in your attachment and don't forget to run build-service command after that. This is mandatory so that you can access this method from LocalServiceUtil object.

(2). If you wanted to fetch content from journal table based on articleId which is stored in your custom table then:

You can simply call "JournalArticleLocalServiceUtil.getArticle(<<articleId>>);" method and you will get JournalArticle object from this method. Hence you will get any content which you wanted to fetch from journal table based on articleId.

Best Regards,
Chirag Patadia.
sasmita swain
RE: fetch content from custom table
1. Februar 2013 00:37
Antwort

sasmita swain

Rang: Regular Member

Nachrichten: 185

Eintrittsdatum: 24. Februar 2012

Neue Beiträge

Thanks for reply

can you tell me if i am clicking on continue button next webcontent should display by sequence wise

how to do?

Thanks

Sasmita