0

我对 grails 中的标准有疑问

我有一个域用户和另一个域对话对话有很多参与者(域)

当我这样做时:

def c = Conversation.createCriteria();
        c.get{
            createAlias('participants', 'p')
            eq 'p.user', user
            eq 'p.folder', folder
            eq 'p.unread', true
            projections{
                count('id')
            }
        }

它通过显示以下标准失败给出错误的输出:

abc.Conversation : 1
    eq('[XYZ]', 'XYZ') == false

    sorry
conv == []

有人可以帮忙吗?

4

1 回答 1

0

hasMany浏览的标准方法criteria是:

def c = Conversation.withCriteria{
          participants{
            eq 'user', user
            eq 'folder', folder
            eq 'unread', true
          }
          ....
 }
于 2015-06-16T19:24:28.847 回答