December 10, 2012

Liferay Service builder : finder methods not created in *ServiceUtil class

I had to generate finder methods via liferay service builder, and was surprised not to find corresponding static utility methods in *ServiceUtil class.

I had to "manually" write the implemenation of those methods in my *LocalServiceImpl.java class. Tod do so, simply call the corresponding *util.findByxxxx method in your implementation method :


// xxxLocalServiceImpl.java :
public List<XXX> findByGroupId(long groupId) throws SystemException {
return xXXPersistence.findByGroupId(groupId);
}
And then re-run service builder build-services task to create the corresponding static utility method in XXXLocalServiceUtil class.


Hope this help.

No comments:

Post a Comment