Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Mat Pink
Service Builder use again
February 18, 2013 3:03 AM
Answer

Mat Pink

Rank: New Member

Posts: 8

Join Date: February 6, 2013

Recent Posts

Hi,

I have created a simple portlet that writes/reads to the database using Service Builder to generate the java object mapping. Now I would like to access the same database tables within a Hook, so I am wondering how I reuse the code generated by service builder.

Do I just re-create the files using the same service.xml? Or is there a way to include already generated files in the new project?

Many thanks for any help.

Regards
Mat
Gnaniyar Zubair
RE: Service Builder use again
February 18, 2013 3:09 AM
Answer

Gnaniyar Zubair

Rank: Liferay Master

Posts: 602

Join Date: December 19, 2007

Recent Posts

Mat Pink
RE: Service Builder use again
February 18, 2013 3:12 AM
Answer

Mat Pink

Rank: New Member

Posts: 8

Join Date: February 6, 2013

Recent Posts

That post looks the business - many thanks Gnaniyar.
Gnaniyar Zubair
RE: Service Builder use again
February 18, 2013 5:10 AM
Answer

Gnaniyar Zubair

Rank: Liferay Master

Posts: 602

Join Date: December 19, 2007

Recent Posts

You can use this property in liferay-plugin-package-properties

required-deployment-contexts=<your portlet plugin name>


or copy that portlet service jar file into your hook manually.
Chirag Patadia
RE: Service Builder use again
February 18, 2013 4:52 AM
Answer

Chirag Patadia

Rank: Junior Member

Posts: 29

Join Date: February 2, 2012

Recent Posts

You can put service.jar file created by service builder into Tomcat/lib/ext which global lib directory of tomcat server. In this way you can directly access service methods from any new projects.
Mat Pink
RE: Service Builder use again
February 18, 2013 5:21 PM
Answer

Mat Pink

Rank: New Member

Posts: 8

Join Date: February 6, 2013

Recent Posts

Thank you all for your help.

Since the Hook I'd like to reuse the code in is a Custom JSP, I could only get things going by adding the service Jar file to root.war (using JBoss). Does that sound about right?

Cheers