0

i have a domain class:

class A{
    String abc
    String def
    Date dateDestruction
}

I want to write a namedQuery or a closure which would enable me to retrieve the count of various objects of the A, on the basis of month and year given. I want to display the objects in the following format:

Feb 2011    Object 1
            Object 2
March 2011  Object 3
            Object 4
            Object 5

Any ideas on how this can be accomplished?

Gaurav Sood
  • 157
  • 3
  • 16

1 Answers1

0

Try using HQL, something along the lines of the following:

A.executeQuery("select * from A a " +
                 "where month(a.dateDestruction) = ? and year(a.dateDestruction) = ?",
                 [/* month */, /* year */])
Jon Burgess
  • 2,035
  • 2
  • 17
  • 27