Mixing Grails query DSL with manual DetachedCriteria building (for exists subqueries)

562 Views Asked by At

Since the current version of Grails/GORM (as of Grails 2.3) doesn't support EXISTS subqueries, I was wondering if it is possible to express my query criteria with the GORM DSL (which is nice and compact) and then manually get the DetachedCriteria from the GORM builder (using getHibernateDetachedCriteria()) and add the EXISTS subquery manually (using the standard Hibernate Criteria API)?

This way, I would still keep the nice and compact expressions for most of the criteria and only the composition of the EXISTS subqueries would look less "GORMY". Moreover, the subquery support may one day get implemented in GORM (see this) and then the subqueries may be replaced by nice GORM DSL code.

0

There are 0 best solutions below