2017-04-14 8 views
0

hibernate 4.3.11.finalを使用しています。 (括弧が追加周辺)Hibernate:サブ選択クエリでIN句を使用する場合のstangeエラー

select distinct doc from DocumentType doc join doc.usages u where u.institute not in :institutes and doc.id not in (select distinct doc1.id from DocumentType doc1 join doc1.usages u1 where u1.institute in :institutes) 

正しく生成された句の最初が、1:

は、我々は、サブ選択クエリを元にで句を使用@query注釈付きリクエストを作りますsubselectではありません。

生成されたSQLは次のとおりです。

select distinct doc from fr.itce.pen.model.customer.folder.DocumentType doc join doc.usages u where u.institute not in (:institutes_0_, :institutes_1_) and doc.id not in (select distinct doc1.id from fr.itce.pen.model.customer.folder.DocumentType doc1 join doc1.usages u1 where u1.institute in :institutes_0_, :institutes_1_)] 

仕事は周りとして宣言されたクエリに括弧で一部に囲むようにある:

select distinct doc from DocumentType doc join doc.usages u where u.institute not in :institutes and doc.id not in (select distinct doc1.id from DocumentType doc1 join doc1.usages u1 where u1.institute in (:institutes)) 

それを動作させるためのより良い方法はあり、最近の休止状態のバージョンで修正されたこの「バグ」ですか?私は休止状態の問題を見ましたが、私はこの動作に関する情報を見つけることができませんでした。

よろしくお願いいたします。

+0

私が噛んでいるように私には見えるhttps://hibernate.atlassian.net/browse/HHH-5126?focusedCommentId=62841&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment- 62841 – Nemesis

答えて

0

おそらくバグですが、4.3では修正されません。

テストケースとJiraの問題を開いて、5.2でそれを複製する必要があります。

+0

ハム私たちはリストにリクエストを渡すので、私はこの面を尊重すると思いますが、おそらく私はあなたの答えを信じていません。 – Nemesis

+0

私は自分の答えを –

+0

更新しました。 – Nemesis

0

これはバグであり、これは、休止状態5.2で修正されました。

関連する問題