首先你要写好两个表的hbm
假设news的hbm为TNews.hbm
news_class的hbm为TNewsClass.hbm
语句:
select tn
from TNews tn
where tn.class in
(select tnc.id
from TNewsClass tnc
where tnc.path like '%+7+%'
or tnc.id='7')