我有AuditQuery
,我想用partition by
添加order by
。
就像我一样:
final AuditReader reader = AuditReaderFactory.get(em);
final List<Test> result = new ArrayList<Test>();
final AuditQuery query =
reader.createQuery().forRevisionsOfEntity(Test.class, false, true);
我想做一些类似的事情:
ORDER by (MAX(VALUE) OVER (PARTITION BY ID ORDER BY ID))
如何在AuditQuery
中实现?
AuditQuery
是在Hibernate Criteria之上构建的,因此它不支持窗口函数,在这种情况下,您需要编写本机SQL。