Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

GRAILS-9402 - mention sqlProjection in whatsNew

  • Loading branch information...
commit 3500beb6e225361f8a1713cd3b4e2cf478221425 1 parent 54f375f
@jeffbrown jeffbrown authored
Showing with 18 additions and 1 deletion.
  1. +18 −1 src/en/guide/introduction/whatsNew22.gdoc
View
19 src/en/guide/introduction/whatsNew22.gdoc
@@ -60,6 +60,23 @@ Grails 2.2 supports forked JVM execution of the Tomcat container in development
See the [documentation|guide:forkedMode] on using forked mode for more information.
+h4. SQL Projections In Criteria Queries
+
+Grails 2.2 adds new functionality to criteria queries to provide access to Hibernate's SQL projection API.
+
+{code:java}
+// Use SQL projections to retrieve the perimeter and area of all of the Box instances...
+def c = Box.createCriteria()
+
+def results = c.list {
+ projections {
+ sqlProjection '(2 * (width + height)) as perimiter, (width * height) as area', ['perimeter', 'area'], [INTEGER, INTEGER]
+ }
+}
+{code}
+
+See the [Criteria|guide:criteria] section for more information.
+
h4. Groovy 2
-Grails 2.2 ships with Groovy 2.0, which has a [bunch of new features|http://www.infoq.com/articles/new-groovy-20] itself.
+Grails 2.2 ships with Groovy 2.0, which has a [bunch of new features|http://www.infoq.com/articles/new-groovy-20] itself.
Please sign in to comment.
Something went wrong with that request. Please try again.