将sql查询转换为hibernate查询以重新运行特定对象的列表

将sql查询转换为hibernate查询以重新运行特定对象的列表,sql,hibernate,hql,converter,Sql,Hibernate,Hql,Converter,我想将下面的查询转换为hql以返回一个列表,因为使用createSqlQuery是不可能的,我必须手动转换结果: 以下是sql查询: Query query = getSessionFactory().getCurrentSession().createSQLQuery( "select * from article where articleID in (select articleI

我想将下面的查询转换为hql以返回一个
列表
,因为使用createSqlQuery是不可能的,我必须手动转换结果:
以下是sql查询:

Query query = getSessionFactory().getCurrentSession().createSQLQuery(
                 "select * 
                  from article 
                  where articleID in (select articleID 
                                      from article_depot 
                                      where depotID = "+depotID+")"
              );

提前感谢您

假设您在
物品仓库
物品
之间存在一个物品仓库关系(一个仓库包含多个物品),如果已正确映射,则查询将为:

Query query = getSessionFactory().getCurrentSession().createQuery("SELECT d.article from article_depot d where d.depotId = :depotId");
query.setParameter("depotId", depotId);
List<article> resultList = query.getResultList();
Query Query=getSessionFactory().getCurrentSession().createQuery(“从文章中选择d.article,其中d.depotId=:depotId”);
query.setParameter(“depotId”,depotId);
List resultList=query.getResultList();