Suppose I have the following Domain class:
class Book {
String title
String author
byte[] largeCoverArtImage
}
I have a list view where I do not need to display largeCoverArtImage
, how can I perform the following SQL query using GORM Criteria?
select title, author from Book
You can run HQL queries that select individual columns with executeQuery:
def titlesAndAuthors = Book.executeQuery('select title, author from Book')
This will return a List of Object[], e.g.
for (row in titlesAndAuthors) {
String title = row[0]
String author = row[1]
...
}