Grails Cookbook - A collection of tutorials and examples

Groovy -e Command Line Option

This post will show how to use Groovy's -e command line option. The Groovy command line tool provides an interactive console to help you learn the Groovy Language. The Groovy -e option is very useful as it gives a quick way for executing simple Groovy scripts.

Groovy Each Loop Examples

This post will show examples on how to use Groovy each() to iterate through objects in a collections.

Grails findAll Tag Examples

This will show examples on how to use the Grails findAll tag(<g:findAll>). This tag is similar to each tag and uses the Groovy JDK findAll method to iterate over each element of a collection and only renders the body if the attribute "expr" is evaluated to true.

Grails join Tag Examples

This will show examples on how to use the Grails join tag (<g:join>). This tag utilizes the Groovy join method to concatenate the toString() representation of each item in a list or collection. A custom separator can also be used for this tag.

Grails Criteria Count Example

This post will show how to get the total number of result with GORM criteria by using the count aggregate function inside criteria projections.

Grails Criteria Projections Examples

We could use Grails criteria projections when we want to select which properties or column to include in the query result. This post will show examples on how to use projections when working with Grails criteria to search for records in the database.

Grails HQL Order By Examples

This post will show how to perform HQL Order By in your Grails applications.

Grails HQL Group By Examples

This post will show how to perform HQL Group By in your Grails applications.

Grails HQL Pagination Examples

This will show examples on how to perform pagination with Grails HQL. A domain's executeQuery method can be used to invoke HQL commands and add pagination logic.

Grails HQL Delete Examples

This post will show how to use delete records on a database table using HQL. Using Grails HQL delete is important on some cases because it is a very efficient solution. Bulk delete can be finished in one go using just one JDBC call.