CreateCriteria with projections does not select all columns

被刻印的时光 ゝ 提交于 2019-12-01 09:30:31

For the sake of those still having this issue; Remove the provided params object on the list method. So the criteria query above becomes:

def sharedDocumentsInstanceList = SharedDocuments.createCriteria().list {
    createAlias('receiver', 'r')
    createAlias('author', 'a')
    eq("r.id",session.uid)  
    projections {
        groupProperty("a.id")
        property("a.firstName","firstName")
        property("a.lastName","lastName")
        property("a.emailAddress","email")
    }
    maxResults(params.max)
    firstResult(params.offset)
    order(params.sort, params.order)
}
    projections{                
        author {
           groupProperty("id")
           property("firstName","firstName")
           property("lastName","lastName")
           property("emailAddress","email")
        }
    }

Would using the above approach yield different results? Just a thought...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!