org.hibernate.QueryException: unexpected token: WI

2019-08-16 12:51发布

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条回答
SAY GOODBYE
2楼-- · 2019-08-16 13:35

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

 where financialDetail.fc=:fc and fhdrinfo.chk='224' 
查看更多
登录 后发表回答