Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it hibernate bug?
    primarykey
    data
    text
    <p>I write</p> <pre><code> String sql = "select candidate_skill.candidate_id from candidate_skill " + "inner join skill on skill.id = candidate_skill.skill_id " + "where skill_id in (:skillIdList) group by candidate_skill.candidate_id " + "Having count(candidate_skill.candidate_id) = (select count(*) from skill where skill.id in (:skillIdList) )"; sql = sql.replace(":skillIdList", generateSkillIdList(skills)); Query query = session.createSQLQuery(sql); List&lt;Candidate&gt; candidates = query.list(); </code></pre> <p>It works good</p> <p>second situation:</p> <pre><code> String sql = "select candidate_skill.candidate_id from candidate_skill " + "inner join skill on skill.id = candidate_skill.skill_id " + "where skill_id in :skillIdList group by candidate_skill.candidate_id " + "Having count(candidate_skill.candidate_id) = (select count(*) from skill where skill.id in :skillIdList )"; Query query = session.createSQLQuery(sql).setParameterList("skillIdList", skills); List&lt;Candidate&gt; candidates = query.list() </code></pre> <p>log:</p> <pre><code>Hibernate: select candidate_skill.candidate_id from candidate_skill inner join skill on skill.id = candidate_skill.skill_id where skill_id in (?, ?) group by candidate_skill.candidate_id Having count(candidate_skill.candidate_id) = (select count(*) from skill where skill.id in ?, ? ) </code></pre> <p>it doesn't works</p> <p>and third:</p> <pre><code>String sql = "select candidate_skill.candidate_id from candidate_skill " + "inner join skill on skill.id = candidate_skill.skill_id " + "where skill_id in :skillIdList group by candidate_skill.candidate_id " + "Having count(candidate_skill.candidate_id) = (select count(*) from skill where skill.id in (:skillIdList) )"; Query query = session.createSQLQuery(sql).setParameterList("skillIdList", skills); List&lt;Candidate&gt; candidates = query.list(); </code></pre> <p>log:</p> <pre><code>Hibernate: select candidate_skill.candidate_id from candidate_skill inner join skill on skill.id = candidate_skill.skill_id where skill_id in (?, ?) group by candidate_skill.candidate_id Having count(candidate_skill.candidate_id) = (select count(*) from skill where skill.id in (?, ?) ) </code></pre> <p>it works good</p> <p>P.S. Pay attention to the Brackets around <code>:skillIdList</code></p> <p>if I use setParameterList("argument",value) and argument in query 2 times, then first time hibernate substitutes brackets and in second - none </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload