Easy Grails with IntelliJ IDEA - 2. Chaining Queries
As promised in the previous post, let’s continue with Grails support in IntelliJ IDEA 8. Today we’ll see how the powerful IntelliJ IDEA‘s code completion applies to the Grails applications.
Suppose you have a Grails application, where you create a domain class, using the New context menu command:

Declare some fields that will be mapped to a datasource:
Next, use the scaffolding to create, for example, a test class, and start typing a query:

This is where code completion comes to help. Press Ctrl+Space. The suggestion list shows all the fields declared in your domain class. Let’s select the findByName option:
After that, press Ctrl+Space once more – now the suggestion list shows combined queries:
With each invocation of code completion, IntelliJ IDEA suggests the appropriate combined queries. Thus, you can go through all the fields of your domain class, and easily create queries of any level of complexity.
- Login or register to post comments
- 2312 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)










Comments
Chao Liu replied on Thu, 2009/01/15 - 5:02am