droggo opened a new issue, #14648:
URL: https://github.com/apache/grails-core/issues/14648
Having domains:
```
class Parent {
String name
static hasMany = [children: Child]
}
class Child {
String name
Related related
static belongsTo = [parent: Parent]
}
```
User could execute following query with detached criteria as subquery:
```
DetachedCriteria subquery = new DetachedCriteria(Child).build {
isNotNull 'name'
}
Parent.createCriteria().list {
inList 'children', subquery
}
```
But this will cause `Syntax error in SQL statement` error with `.. (SELECT
FROM CHILD ..` as cause of the error. SELECT is empty. Workaround is to use
projection in detached criteria, for example
```
projections {
groupProperty 'id'
}
```
Example project is here: https://github.com/droggo/GrailsSubqueries
Integration Spec to demo this problem:
https://github.com/droggo/GrailsSubqueries/blob/master/src/integration-test/groovy/error/DetachedCriteriaDomainSubqueryIntegrationSpec.groovy
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]