Grails 具有动态参数的Gorm查找器?

Grails 具有动态参数的Gorm查找器?,grails,gorm,Grails,Gorm,我使用的是GORM finder,但我得到了一个运行时错误,我认为这是因为我的语法不正确。以下是我遇到问题的代码行: def accountsOwnedByUser = AccountRecord.findAllWhere(owners.contains(indivRecord.uniqueId)) 其中owners是AccountRecord类的列表属性。我想找到给定帐户的所有所有者,我通过搜索其唯一id出现在帐户所有者列表中的个人来实现这一点。但目前我得到了这个错误: No such pr

我使用的是GORM finder,但我得到了一个运行时错误,我认为这是因为我的语法不正确。以下是我遇到问题的代码行:

def accountsOwnedByUser = AccountRecord.findAllWhere(owners.contains(indivRecord.uniqueId))
其中owners是AccountRecord类的列表属性。我想找到给定帐户的所有所有者,我通过搜索其唯一id出现在帐户所有者列表中的个人来实现这一点。但目前我得到了这个错误:

No such property: owners for class: com.twc.fatcaone.FileImportService. Stacktrace follows:
Message: No such property: owners for class: com.twc.fatcaone.FileImportService
    Line | Method
->>  968 | doCall                         in com.twc.fatcaone.FileImportService$_$tt__deleteIndividualRecord_closure18
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    967 | $tt__deleteIndividualRecord    in com.twc.fatcaone.FileImportService$$EOkgHOSW
|    168 | doCall . . . . . . . . . . . . in com.twc.fatcaone.FileImportService$_$tt__excelIndividualFileUpload_closure16$$EOkgHOSW
|    162 | $tt__excelIndividualFileUpload in com.twc.fatcaone.FileImportService$$EOkgHOSW
|    147 | upload . . . . . . . . . . . . in com.twc.fatcaone.CustomerController
|    198 | doFilter                       in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter . . . . . . . . . . . in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker                      in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run                            in java.lang.Thread

我需要类似于
it.owners
的东西或类似的东西,可以用作GORM的dynamic finder的参数。有类似的吗?

你在找这样的东西吗

def idToSearchFor = indivRecord.uniqueId
AccountRecord.where {
    idToSearchFor in owners    
}.list()

如果没有看到您的模型,我无法确定,但类似的东西可能会有所帮助。

这会给我一个AccountRecord对象的列表,使其所有者(List)属性包含indivRecord的唯一id吗?如果是这样,我想这正是我需要的。