1. Create a folder named custom-sql under the src folder.
2. Create a default.xml file in the custom-sql folder.
3. Create another xml file in the custom-sql folder, this file contains the custom sql query.
4. Create a class say
SampleFinderImpl in the persistent package. This class will extends the
BasePersistenceImpl<Sample> and implements
SampleFinder.
5. Now build the service, it will generate the
SampleFinder Interface.
6. Now define methods to execute custom sql in the
SampleFinderImpl class.
7. Build the service; it will generate the
SampleFinderUtil class with the method defined in the
SampleFinderImpl class.
8. Copy the generated method definition from
SampleFinderUtil and place it in the
SampleLocalServiceImpl.
9. Build the service; it will place the methods definition in the
SampleLocalServiceUtil from
EntryLocalServiceImpl.
1. Create a folder named custom-sql under the src folder.
2. Create a default.xml file in the custom-sql folder.
3. Create another xml file in the custom-sql folder, this file contains the custom sql query.
4. Create a class named (EntryFinderImpl) in the persistent package. This class will extends the BasePersistenceImpl<Entry> and implements EntryFinder.
5. Now build the service, it will generate the EntryFinder Interface.
6. Now define methods to execute custom sql in the EntryFinderImpl class.
7. Build the service; it will generate the EntryFinderUtil class with the method defined in the EntryFinderImpl class.
8. Copy the generated method definition from EntryFinderUtil and place it in the EntryLocalServiceImpl.
9. Build the service; it will place the methods definition in the EntryLocalServiceUtil from EntryLocalServiceImpl.
10. Now the method is available to call from any portlet class.