我写了以下内容query
。
select
count (distinct asset.assetId)
from
Asset asset
left join asset.assetTitles title
left join asset.distTypes distTypes
where
title.program.id in (:progIdParam)
and distTypes in (:lkpDistTypeId)
and asset.active = 1
and asset.isShow = 1
and asset.classification = 'Internal Use'
我称之为:
private Long assetTitleListForIp = 0L;
assetTitleListForIp = (Long)entityManager
.createQuery(query)
.setParameter("progIdParam",progId)
.setParameter("lkpDistTypeId",LookupValueEnum.DIST_TYPE_INTL_PRODUCTION.getLkpId())
.getSingleResult();
如果我在 Eclipse 控制台中触发查询并在 DB 中运行它,它将显示计数为 1。但在应用程序中,对于assetTitleListForIp,它将值分配为零。我没有得到我所犯的小错误。有人可以帮忙吗?