实体未Map,Hibernate组织,hql,ast,查询语法异常

brjng4g3  于 2022-12-29  发布在  其他
关注(0)|答案(1)|浏览(166)

控制台显示:
org. hib. hql.ast.QuerySyntaxException custSiteAcct没有Map,实体在****之间,下面是获取问题的Hibernate查询,但是方法遇到Map问题。

public List<StdQuestion> findTaxQuestionBySba(List<Long> sbaIds, String companyType, long acctNbr) {
Session session = getSession();
        String qw ="from StdQuestion as x"+
                " join fetch x.stdTaxQstns as x1" +
                " left join fetch x1.stdTax as x3"+
                " where x1.id.taxCde in (select z.taxCde from StdTax as z "+
                "join z.stdNaicsTaxes as z1 "+
                "join z1.naicsMaster as z2 "+
                "join z2.stdBusActivityNaicsMaps as z3 "+
                "join z3.stdBusinessActivity as z4 "+
                "where z4.businessActivityId in (:sbaId) "+
                "and z4.exprnDt is null "+
                "and z3.exprnDt is null) " +
                " and x.exprnDt is null" +
                " and x1.targetTableNm is null" + 
                " and upper(x.rspnType) != upper('SUP') " +
                " and x.custTypeCde in (:custypeCode)" +
                " and x.qstnCategoryCde = :qstncode " +
                "and x1.id.taxCde not in (select st.taxCde"
                + "    from custSiteAcct as csa "
                + "    left join fetch csa.id as x2 "
                + "    left join fetch csa.customer as c "
                + "    left join fetch csa.applicableTax as at "
                + "    left join fetch stf.stdTax as st "
                + "    left join fetch at.stdTaxForm as stf"
                + "    where csa.id.cusAcctNbr = at.acctNbr"
                + "    and x2.cusAcctNbr = :acctNbr"
                **+ "    and at.custSiteAcct.id = x2"**
                + "    and at.acctNbr = c.acctNbr"
                + "    and at.siteNbr = csa.id.siteNbr"
                + "    and at.exprnDt is null"
                + "    and c.custAcctEndDt is null"
                + "    and csa.id.cusAcctNbr = :acctNbr)"
                + "order by x1.sortSeqNbr"
                ;
        Query q = session.createQuery(qw);
        q.setParameterList("sbaId", sbaIds);
        q.setParameterList("custypeCode", companyType  != null ? new Object[] { "ALL", companyType } : new Object[] { "ALL"} );
        q.setParameter("qstncode", "T");
        q.setParameter("acctNbr", acctNbr);
        return q.list();
    }
ifsvaxew

ifsvaxew1#

您必须在查询中使用Entity类名将custSiteAcct更改为CustSiteAcct

相关问题