Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I get List<Strings> by executing a query. This must be passed to another query of IN clause values. How to pass them in HQL?

We can convert List to Array and can pass it, that's not a problem.

Finally, I must pass the list in List<String> or Array or String form to the IN clause.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
337 views
Welcome To Ask or Share your Answers For Others

1 Answer

from AUTOS a where a.model in (select m.model from MODELS m) 

or

Query query1 = session.createQuery("select s.id from Salary s where s.salary < 50000 AND s.salary > 49980");
Query query2 = session.createQuery("from Employee e where e.id in (:ids)").setParameterList("ids", query1.list());
query2.list();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...