Portlet development best practices
We talked about some of the key UI best practices. Now let's talk about some of the key portlet development best practices to achieve best performance.
Limiting the use of dynamic queries
To implement the service and persistence layer in custom portlets, Liferay provides a very good code generator called Service Builder. Service Builder generates a persistence layer using the Hibernate framework. Service Builder also generates code in the Service and Persistence classes to cache responses in a multi-VM cache pool. Service Builder provides a way to define finder methods using an XML configuration. Responses of these finder methods are also cached in a multi-VM cache pool. Liferay Service Builder also provides a way to execute dynamic queries using the dynamic query API. Service Builder generates methods in the service and persistence layer to execute dynamic queries. Here is an example of dynamic query execution:
DynamicQuery query = DynamicQueryFactoryUtil...