Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Accessing Tables Using Service Builder
Hi all !I made a table using service builder. Now in that current project i can easily access the table by importing "package.model.impl" and "package.service" packages. But I am having trouble when i need to access the table from another project. Please help me how can i access these tables from another projects !! One way was by using jdbc connection and then hitting sql queries. But i want to know how can i do this using service builder !!
HI Vivek,
Try to use LocalServiceUtil of another project in your new. You can do this by using JAR of other project into your current project.
Venky
Try to use LocalServiceUtil of another project in your new. You can do this by using JAR of other project into your current project.
Venky
Vivek Mehta:
I'm assuming you're on 6.2, as you've just asked another question about that version (please add the version in every question):
Hi all !I made a table using service builder. Now in that current project i can easily access the table by importing "package.model.impl" and "package.service" packages. But I am having trouble when i need to access the table from another project. Please help me how can i access these tables from another projects !! One way was by using jdbc connection and then hitting sql queries. But i want to know how can i do this using service builder !!
If you declare a dependency on that other service-builder-project in liferay-plugin-package.properties (by using required-deployment-contexts=your-other-plugin), that project's service.jar will be available to your own plugin, and you can use the services from that other project. No need for JDBC access to those tables (which would be breaking the encapsulation and introduce all kinds of caching inconsistencies anyway)
Thanks Olaf,
I implemented what you said. But still i am facing difficulty in accessing the table. Before in old project I used " oldproject p1 = new oldprojectImpl(); " and then accessed the tables by using p1.setName("vivek") and p1.getName() . But I am not able able to import this oldprojectImpl package in new project. Though i am able to import the model, service and local service util packages but i am not getting how to use these in accessing the table. Please help ..
I implemented what you said. But still i am facing difficulty in accessing the table. Before in old project I used " oldproject p1 = new oldprojectImpl(); " and then accessed the tables by using p1.setName("vivek") and p1.getName() . But I am not able able to import this oldprojectImpl package in new project. Though i am able to import the model, service and local service util packages but i am not getting how to use these in accessing the table. Please help ..
You should have a class "oldprojectLocalService" available. That class contains various create/read/update/delete methods for your entities.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™