鉴于此分离查询:
DetachedCriteria notExistInCriteria = DetachedCriteria.forClass(ReportTelephonyEvent.class, "r2");
notExistInCriteria.add(Restrictions.eq("child", child));
notExistInCriteria.add(Restrictions.eqProperty("countryCode", "r1.countryCode"));
notExistInCriteria.add(Restrictions.eqProperty("phonenumber", "r1.phonenumber"));
notExistInCriteria.add(Restrictions.or(Restrictions.lt("startTime", start), Restrictions.gt("startTime", end)));
notExistInCriteria.setProjection(Projections.property("phonenumber"));
我现在设置了 Projection “phonenumber”,但我想将其设置为 1,这样输出查询将是这样的:
SELECT 1 FROM bpr_report_telephony_event .............
如何设置 Projection 以使 Hibernate 在选择列中只有“1”?