Create a detached query for a domain class like this
The query works when using criteria.findAll() but fails when trying to update or delete the resulting records:
def resultCount = criteria.updateAll(myInt: 20)
The bug seems to be located in org.grails.datastore.mapping.query.jpa.JpaQueryBuilder:586 where the query is appended to the projection and not to the selection part.
The resulting query then looks like: