Search code examples
liferayliferay-7liferay-service-builder

ServiceBuilder not creating FinderImpl class?


I create some services using Liferay 7 . But FinderImpl and FinderUtil classes are not created after building services.The steps I followed are as follows:

  1. Created a service builder project.
  2. Created finder columns.
  3. Built and deployed the *-api and *-service...where * is the project/service name.
  4. Refresh the project using gradle ->Refresh Gradle Project.
  5. Dragged and dropped the *-service and *-api onto the running server.

Result: it creates the table but *FinderImpl and *FinderUtil classes are not there in the project.


Solution

  • You have to create your *FinderImpl class and rebuild service because Finder classes are not created by default. According to the Liferay documentation:

    The first step is to create a *FinderImpl class in the service persistence package. For the Guestbook application, for example, you could create a EntryFinderImpl class in the com.liferay.docs.guestbook.service.persistence.impl package. Your class should extend BasePersistenceImpl<Entry>.

    Run Service Builder to generate the *Finder interface and the *Util class for the finder. Service Builder generates the *Finder interface and the *FinderUtil utility class based on the *FinderImpl class. Modify your *FinderImpl class to have it implement the *Finder interface you just generated:

    Source: https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/custom-sql