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.