留言板

Retrieving data from existing database

Madhuri Sonawane,修改在11 年前。

Retrieving data from existing database

New Member 帖子: 10 加入日期: 12-8-6 最近的帖子
hi,
I want to retrieve the data from existing database and display it on new port-let of life-ray.
Please can some one help me..?
thumbnail
Amit Doshi,修改在11 年前。

RE: Retrieving data from existing database

Liferay Master 帖子: 550 加入日期: 10-12-29 最近的帖子
Madhuri Sonawane:
hi,
I want to retrieve the data from existing database and display it on new port-let of life-ray.
Please can some one help me..?


xxxLocalServiceUtil Class and use there respective functions to get appropriate data.
thumbnail
devaraj s,修改在11 年前。

RE: Retrieving data from existing database

Regular Member 帖子: 228 加入日期: 12-5-21 最近的帖子
Madhuri Sonawane:
hi,
I want to retrieve the data from existing database and display it on new port-let of life-ray.
Please can some one help me..?



refer attached pdf.. so it will definitly help you.
Madhuri Sonawane,修改在11 年前。

RE: Retrieving data from existing database

New Member 帖子: 10 加入日期: 12-8-6 最近的帖子
I have already use this pdf and display data on same portlet, but I want to access that database & display on new portlet for doing some operation.
thumbnail
Mayur Patel,修改在11 年前。

RE: Retrieving data from existing database

Expert 帖子: 358 加入日期: 10-11-17 最近的帖子
Can you just share information in more detail?

 I want to access that database & display on new portlet for doing some operation.


If you want to access database, Have you made entry in portal-ext.properties for DB connection?

Do you want to access custom table which is created by service builder or any OOTB table?

As Amit specified, you can use xxxLocalServiceUtil for performing any operation say add,view,update,delete etc.

Thanks.
thumbnail
Rewati Raman,修改在11 年前。

RE: Retrieving data from existing database

Junior Member 帖子: 97 加入日期: 12-2-24 最近的帖子
Hi Mayur,
I think she has created the service.xml in one portlet project and trying to access in other portlet project

so as i did
i had copied the jar file from the portlet's lib folder and copied in Liferay-portal/tomcat/lib/ext and it worked for me
then i was able to access all the implemented methods from that portlet

Regards,
Rewati Raman
thumbnail
David H Nebinger,修改在11 年前。

RE: Retrieving data from existing database

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Rewati Raman:
i had copied the jar file from the portlet's lib folder and copied in Liferay-portal/tomcat/lib/ext and it worked for me
then i was able to access all the implemented methods from that portlet


Wrong wrong wrong.

The service consuming plugin must add the service providing plugin as a required deployment context in the IDE. Everything else will be taken care of.
thumbnail
Mayur Patel,修改在11 年前。

RE: Retrieving data from existing database

Expert 帖子: 358 加入日期: 10-11-17 最近的帖子
Right David, only required plugins we can add in liferay-plugin-package.xml instead of making it global by putting same in lib/ext
thumbnail
Rewati Raman,修改在11 年前。

RE: Retrieving data from existing database

Junior Member 帖子: 97 加入日期: 12-2-24 最近的帖子
Thanks Mayur
for correcting me
mayur if you have some sample file where you have included the plugins in liferay-plugin-package.xml
it would be good for me
because till now i used in above mentioned method

Regards,
Rewati Raman
thumbnail
Mayur Patel,修改在11 年前。

RE: Retrieving data from existing database

Expert 帖子: 358 加入日期: 10-11-17 最近的帖子
Just you need to add jars entry like below,

portal-dependency-jars=\
    jstl-api.jar,\
    jstl-impl.jar,\
    sample-portlet-service.jar // which is there in web-inf/lib

Thanks.
thumbnail
David H Nebinger,修改在11 年前。

RE: Retrieving data from existing database

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Mayur Patel:
Just you need to add jars entry like below,

portal-dependency-jars=\
    jstl-api.jar,\
    jstl-impl.jar,\
    sample-portlet-service.jar // which is there in web-inf/lib

Thanks.


Wrong wrong wrong.

You cannot use portal-dependency-jars unless it comes from ROOT/WEB-INF/lib. Since it does not, you must use required-deployment-contexts. If the portlet providing the service is named "service-provider-portlet", your entry in liferay-plugin-package.properties would be:

required-deployment-contexts=\
    service-provider-portlet


The IDE will do the right thing and pull the jar in for you...
thumbnail
Sagar A Vyas,修改在11 年前。

RE: Retrieving data from existing database

Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
This is something interested, Thank You David for sharing this.

Thanks,
Sagar Vyas
Madhuri Sonawane,修改在11 年前。

RE: Retrieving data from existing database

New Member 帖子: 10 加入日期: 12-8-6 最近的帖子
Please give me steps to perform this procedure to access database in new portlet.

Thank you
thumbnail
David H Nebinger,修改在11 年前。

RE: Retrieving data from existing database

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Madhuri Sonawane:
Please give me steps to perform this procedure to access database in new portlet.


Sure.

Step #1: Read the documentation about Service Builder.
Step #2: Repeat step #1 until you understand how to build and understand database access.
thumbnail
Ramkumar Chandran,修改在11 年前。

RE: Retrieving data from existing database

Junior Member 帖子: 28 加入日期: 11-11-15 最近的帖子
I'm couldn't understand the concept of service builder.
Like accessing other tables data(using foreign key). etc.
Is thee any forum post or any other doc which explain the concept ,....
thumbnail
David H Nebinger,修改在11 年前。

RE: Retrieving data from existing database

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Liferay doesn't use FKeys at all in SB as it imposes restrictions during upgrade handling.

For the most part you're left to manage relationships on your own via code in your XxxLocalServiceImpl classes.
thumbnail
Sagar A Vyas,修改在11 年前。

RE: Retrieving data from existing database

Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
Ramkumar Chandran:
I'm couldn't understand the concept of service builder.
Like accessing other tables data(using foreign key). etc.
Is thee any forum post or any other doc which explain the concept ,....


Hi Ramkumar,

There are lots of thing you can do by using service builder.

Like you don't need to create table manually in DB or Utill classes which helps you to communicate with DB.

More information you can see SB

HTH.

Thanks,
Sagar Vyas
thumbnail
Hitoshi Ozawa,修改在11 年前。

RE: Retrieving data from existing database

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
I'm couldn't understand the concept of service builder.
Like accessing other tables data(using foreign key). etc.


You're missing the main thought behind service builder - developers uses entity services and not database tables. Forgot everything about using database table and only think about using entity services. This is also the main idea behind Amazon's systems - applications use entities and not database. This is how they keep their system flexible and also how applications build with service builder can be flexible.
Madhuri Sonawane,修改在11 年前。

RE: Retrieving data from existing database

New Member 帖子: 10 加入日期: 12-8-6 最近的帖子
You refer this link,
it might be help you

Doc of Service Builder


Thanks,
Madhuri
thumbnail
Rewati Raman,修改在11 年前。

RE: Retrieving data from existing database

Junior Member 帖子: 97 加入日期: 12-2-24 最近的帖子
thanx david
your suggestions worked for me.
thumbnail
Sagar A Vyas,修改在11 年前。

RE: Retrieving data from existing database

Liferay Master 帖子: 679 加入日期: 09-4-17 最近的帖子
Madhuri Sonawane:
hi,
I want to retrieve the data from existing database and display it on new port-let of life-ray.
Please can some one help me..?


Madhuri,

1st : For which from which table you want to retrieve data.
2nd : Try to find out name of that portlet from (\liferay-portal-src\portal-web\docroot\WEB-INF\portlet-custom.xml)
3rd : for example portlet name is User then you will find userLocalServiceUtil by which you can access all relative information of user
(This is same as we build the service and access that by ***LocalServiceUtil)

Hope this clear.

Thanks,
Sagar Vyas