使用 'between' 的 DetachedCriteria 出错

Error in DetachedCriteria using 'between'

只有在 DetachedCriteria[=] 中的 association 中使用 'between' 时才会发生错误30=]:

错误:

org.hibernate.QueryException: could not resolve property: execution_alias1 of: ExecutionService

条件:

new DetachedCriteria(Service).build {
    execution {
        between('date', new Date() -1, new Date())
    }
}.list()

域类:

class Service{

   static hasOne = [execution: ExecutionService]

   static constraints = {
      execution nullable: true
   }
}

class ExecutionService {

   Date date
   static belongsTo = [servico: Servico]

   static constraints = {
      date nullable: true
      servico nullable: true
   }
}

OBS:Grails 版本:3.1.8

当我在 'build' 中有另一个块时,'between' 似乎不起作用(就像我的 "execution" 块)。

所以我使用了那个解决方案(将 'between' 更改为 'ge' 和 'le'):

new DetachedCriteria(Service).build {
    execution {
        ge 'date', new Date() -1
        le 'date', new Date()
    }
}.list()