我有一个实体如下:
class entity {
Long id,
String createdBy,
String status,
Date lastModified
}
我想为以下SQL创建一个Hibernate条件查询:
select a.id, a.createdBy, a.status
from entity a
join ( select status, max(lastModified) lastModifiedOn
from entity
where status in ('A','B','C')
group by status) b on a.lastModified = b.lastModifiedOn and a.status = b.status;
我该怎么做?什么是标准查询?我应该在条件查询中创建“子标准”查询吗?