0
用普通的SQL:集團通過爲JPA
select e.*
from (
select type, source, max(timestamp) as maxtimestamp
from handelse
group by type, source
) other join event e
on e.type=other.type and
e.source=other.source and
e.timestamp = other.maxtimestamp
join eventpost ep on e.id = ep.event_id;
的事件記錄了最新的時間戳。有趣的是,JPA不允許在from子句中進行子選擇。任何想法如何重新將查詢寫入JPA可以吞嚥的東西?底層數據庫是Oracle。