Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Liferay Portal Systems Development

You're reading from   Liferay Portal Systems Development Build dynamic, content-rich, and social systems on top of Liferay with this book and ebook

Arrow left icon
Product type Paperback
Published in Jan 2012
Publisher Packt
ISBN-13 9781849515986
Length 546 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (17) Chapters Close

Liferay Portal Systems Development
Credits
About the Author
Acknowledgement
About the Reviewers
1. www.PacktPub.com
2. Preface
1. Liferay Enterprise Portal FREE CHAPTER 2. Service-Builder and Development Environment 3. Generic MVC Portlets 4. Ext Plugin and Hooks 5. Enterprise Content Management 6. DDL and WCM 7. Collaborative and Social API 8. Staging, Scheduling, Publishing, and Cache Clustering 9. Indexing, Search, and Workflow 10. Mobile Devices and Portlet Bridges

Custom query


A custom query allows creating dynamic criteria, like dynamic query API. In many situations, this avoids the need to create a custom query completely. However, in some cases, a custom query, called custom-sql, could be useful. For instance, there is a complex JOIN query and it is hard to do in the dynamic query API. In this case, custom query would be very helpful.

Let's consider a real example. A query says "find me all the articles with a specific companyId and groupId, subscribed to by a specific user, ordered by createDate". Of course, you could use the dynamic query API. Here, we are using this request as an example to show how to build a custom query in the Plugins SDK.

In general, you should be able to build a custom query in the Plugins SDK in five steps:

  1. 1. Create a folder named custom-sql under $PLUGINS_SDK_HOME/portlets/${portlet.name}/docroot/WEB-INF/src and create a file named default.xml under custom-sql with the following lines:

    <?xml version="1.0"?>
    &lt...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image