I had the same problem and tried to read the HQL documentation, however some functions do not seem to be implemented in NHibernate (e.g. with a keyword)
I got this solution:
select p
FROM Post p
JOIN p.Tags tag1
JOIN p.Tags tag2
WHERE
tag1.Id = 1
tag2.Id = 2
Value, dynamically create HQL using the union for each tag, then make a selection in your WHERE clause. It worked for me. I tried to do the same with DetachedCriteria, but ran into difficulties when trying to join the table several times.
jishi source
share