这是我的 SQL 查询
select * from customer where cust_acnt_nbr IN
(select cust_acnt_nbr from Asset where dstrct_id IN
(select dstrct_id from dstrct where dstrct_nm = 'ATLANTA'))
我将此 SQL 转换为 HQL
final Query query = getCurrentSession().createQuery(
"from customer where cust_acnt_nbr in (select cust_acnt_nbr from Asset where dstrct_id in (select dstrct_id from dstrct where dstrct_nm = :name))");
query.setParameter("name", districtName);
这给出了一个错误:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.hql.internal.ast.QuerySyntaxException: customer is not mapped [from customer where cust_acnt_nbr in (select cust_acnt_nbr from com.ironmountain.model.Asset where dstrct_id in (select dstrct_id from dstrct where dstrct_nm = :name))]