Grails Cookbook - A collection of tutorials and examples

Grails Select Enum Values

It is more convenient that we use Enums in our domain classes rather than String, when we are really sure that Enum is the best representation of a property. Maintaining Strings and constants is just a pain. But it is common problem on how to create a form that accepts Enum values. Below is an example on how to use Select Tag inGrails to choose from Enum values.

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.

Grails HQL Update Examples

This post will show examples on how to use Grails HQL Update operations on a database. Using Grails HQL for bulk update operations is very efficient because a task can be completed in one go.

Grails HQL Count Examples

This post will show how to use the COUNT aggregate function inside Grails/GORM HQL statements. Just like in SQL, HQL COUNT statements returns the number of rows that matches a specified criteria.

Grails HQL Join Examples

This post will show how to perform HQL Joins with one to many relationships and other cases. Joins are important when you need to check two or more tables to retrieve the required information