は、私は以下のフィールドを持つ2つのエンティティを持っている問い合わせますより多くのバージョンでは、最も最近のcreationDateを持つApplicationVersionのversionNameをtransientフィールドのlastVersionに入れます。Combinate 2 HQLは
SELECT a from Application a where a not in (select b.application from ApplicationVersion b)
そして、このバージョン管理のものの最後のバージョンを取得する:
すべてのバージョン管理外のアプリケーションを取得するためにこの1:私は2つのHQLクエリでこれをやっている。この時点では
select b from ApplicationVersion b where b.creationDate = (select max(bb.creationDate) from ApplicationVersion bb where bb.application = b.application)
両方を実行した後、2番目の結果セットを繰り返して、このアプリケーションと最後のエラーを最初のresulsetに追加します。
しかし、私は、この(これがすべてでは動作していない)のようなもので、両方のクエリをcombinateたい:
select new foo.bar.Application(a.applicationId, a.name, a.description, b.version) from Application a, ApplicationVersion b where
(a not in (select bb.application from ApplicationVersion bb))
or
(a=b.application and b.creationDate = (select max(bb.creationDate) from ApplicationVersion bb where bb.application = b.application))
両方のクエリをcombinateと一つだけを実行し、DOを回避するために、任意の(効率的な)方法はあります反復はプログラムによって行われますか?