HQL:where 子句中的未知列
HQL: Unknown column in where clause
我正在尝试计算 hql 查询的行数。我收到 TypeOfPermission 列不存在的警告。这让我觉得很奇怪,因为以前的查询确实有效。下面的行返回 2 行(如预期的那样)
from ClientIdentity c left join fetch c.Permissions p where p.TypeOfPermission = :permissionType;
但是使用以下计数查询,查询失败,因为现在不再识别列 TypeOfPermission。
countQuery = "select count(*) from ClientIdentity c left join fetch c.Permissions p where p.TypeOfPermission = :permissionType";
long count = countQuery.UniqueResult<long>();
你改变:
c.Permissions to Permissions
使用"Count(*)"时,不需要"fetch"。
countQuery = "select count(*) from ClientIdentity c left join c.Permissions p where p.TypeOfPermission = :permissionType";
long count = countQuery.UniqueResult<long>();
我正在尝试计算 hql 查询的行数。我收到 TypeOfPermission 列不存在的警告。这让我觉得很奇怪,因为以前的查询确实有效。下面的行返回 2 行(如预期的那样)
from ClientIdentity c left join fetch c.Permissions p where p.TypeOfPermission = :permissionType;
但是使用以下计数查询,查询失败,因为现在不再识别列 TypeOfPermission。
countQuery = "select count(*) from ClientIdentity c left join fetch c.Permissions p where p.TypeOfPermission = :permissionType";
long count = countQuery.UniqueResult<long>();
你改变:
c.Permissions to Permissions
使用"Count(*)"时,不需要"fetch"。
countQuery = "select count(*) from ClientIdentity c left join c.Permissions p where p.TypeOfPermission = :permissionType";
long count = countQuery.UniqueResult<long>();