Created
October 21, 2014 05:11
-
-
Save jeantessier/03dd22e7db0e9f23cf04 to your computer and use it in GitHub Desktop.
Building a histogram from a Grails criteria search.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Employee.withCriteria { | |
projections { | |
groupProperty "gender" | |
rowCount() | |
} | |
}.inject([:]) { histo, row -> | |
histo[row[0]] = row[1] | |
histo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment