我收到 grails 查询错误。我有班级用户:
class User {
String username
String passwordHash
static hasMany = [roles: Role, permissions: String, clients: User, owners: User]
}
当我查询时:
def addClient() {
def principal = SecurityUtils.subject?.principal
User currentUser = User.findByUsername(principal);
if (request.method == 'GET') {
User user = new User()
[client: currentUser, clientCount: User.countByOwners(currentUser)]
}
}
Grails 说:
参数“#1”未设置;SQL 语句:select count(*) as y0_ from user this_ where this_.id=? [90012-164]
为什么?