【发布时间】:2017-01-13 20:00:00
【问题描述】:
我有一个 Hibernate 查询来检索限制为最大数量的行列表。但是当我阅读 Hibernate 日志时,令我惊讶的是,它在内部过滤了一个子查询,该子查询只有一行 select count(*)
-- Log4j
-- INFO [STDOUT] Hibernate:
select *
from ( select count(*) as y0_
from yyy this_
where this_.type=3 and
this_.VALUE=2 and
this_.src='ZZZZZ'
)
where rownum <= 100;
外部条件是这样的:
criteria.setProjection(Projections.rowCount());
criteria.setMaxResults(MAX_RESULTS); // MAX_RESULTS = 100
final List results = criteria.list(); // It executes the above query here.
对这种行为的解释是什么?我对日志中有更多关于这种误导性结果的查询。
【问题讨论】:
标签: java hibernate oracle11g log4j