AuditQuery Hibernate按分区添加顺序

时间:2015-07-06 11:32:35

标签: hibernate audit database-partitioning

我有AuditQuery,我希望order by添加partition 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中完成?

1 个答案:

答案 0 :(得分:2)

AuditQuery建立在Hibernate Criteria之上,因此它不支持窗口函数,在这种情况下,您需要编写本机SQL。