Wondering why the "where" query bails out in the last example of the following. There is no "where" clause to the where query in case #5 - all Assignments are listed instead of just one. I am executing this in the Grails console, Grails 3.2.5.
import org.grails.compiler.injection.GrailsAwareClassLoader
def domainName = "Assignment"
def domainPathName = "somepath.$domainName"
def domainClass = new GrailsAwareClassLoader().loadClass(domainPathName)
println "1 -----------"
def c = domainClass.createCriteria()
println c.list {
eq "id", 9361L
}
println "2 -----------"
def wc = domainClass.withCriteria() {
eq "id", 9361L
}
println wc.toList()
println "3 -----------"
def d = new DetachedCriteria(domainClass).build {
eq "id", 9361L
}
println d.list()
println "4 -----------"
def wa = Assignment.where {
id == 9361L
}
println wa.list()
println "5 -----------"
def w = domainClass.where {
id == 9361L
}
println w.list()