org.hibernate.QueryException: unexpected token: WITH in hql

倾然丶 夕夏残阳落幕 提交于 2019-12-25 07:20:02

问题


Hi am trying to join the tables with specific condition and when i executing the below query and am getting the below error

 org.hibernate.QueryException: unexpected token: WITH [

my HQL QUERY is below...

> List results1=session.createQuery("select financialDetail from
> FinancialDetail financialDetail " +
>                "left join financialDetail.financialClaimHeaderInfo fhdrinfo WITH (fhdrinfo.chk='224') "+
>                " where financialDetail.fc=:fc")
>                .setParameter("fc",fc)
>                .list();

In the financialDetail.hbm file i have a mapping between these two table like

<set name="financialClaimHeaderInfo" table="F_CLM_HDR_TB" lazy="true" inverse="true" cascade="all" >
          <key column="F_FCN_NUM" />
          <one-to-many class="com.FinancialClaimHeaderInfo"/>
      </set>

Pls guide me what is wrong here...


回答1:


You should try to put 'fhdrinfo.chk='224' into the where-condition.

 where financialDetail.fc=:fc and fhdrinfo.chk='224' 


来源:https://stackoverflow.com/questions/38854216/org-hibernate-queryexception-unexpected-token-with-in-hql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!