HQL を介して次のクエリを実行しようとしていますが、スタックしており、このクエリは結果を表示していません。
select s from Serie s where
(s.arrivalSerie is not null and s.arrivalSerie.company.isEnable=1)
or (s.departureSerie is not null and s.departureSerie.company.isEnable=1)
このクエリを次のようにスローしています。
Query query = em.createQuery("previous query");
query.setFirstResult(initialElement);
このクエリをテストしているときに、このクエリの任意の部分 (「または」) を結果で実行できることがわかりました。しかし、クエリ全体が実行されると、0 要素のコレクションが得られます。
何か案は?
アップデート:
理解しやすい翻訳されたクエリは次のようになります。
select
s.*
from
serie s,
arrivalSerie a,
company ca,
departureSerie d,
company cd
where
s.idArrivalSerie=a.idArrivalSerie
and a.CompanyCode=ca.CompanyCode
and s.idDepartureSerie=d.idDepartureSerie
and d.CompanyCode=cd.CompanyCode
and (
(
s.idArrivalSerie is not null
)
and ca.isEnable=1
or (
s.idDepartureSerie is not null
)
and cd.isEnable=1
) limit 0,10;
もちろん、これは MySql クライアントでの結果を示しているわけではありません