使用Hibernate NamedQuery

时间:2015-07-16 02:29:15

标签: java hibernate runtime-error

我的Hibernate hbm文件看起来像这样。运行此查询时遇到问题。查询在sql开发人员上运行正常,但是在运行我的java应用程序时,它抛出了SQL错误:17006,SQLState:99999错误,它表示无效列。我尝试了许多方法来删除列并更改属性名称,但找不到解决方案。

2015-07-16 12:15:14,374 [http-bio-8080-exec-8] DEBUG   com.adp.au.hibernate.HibernateUtils     - HibernateUtils.closeSession(false) for session depth: [1]
2015-07-16 12:15:14,389 [http-bio-8080-exec-8] ERROR com.adp.au.timesheet.action.SubmitError     - Client: [29010], User: [ADMIN] exception: [could not execute query]
2015-07-16 12:15:14,389 [http-bio-8080-exec-8] ERROR com.adp.au.timesheet.action.SubmitError     - Client: [29010], User: [ADMIN] stacktrace: org.hibernate.exception.GenericJDBCException: could not execute query
    at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    at org.hibernate.loader.Loader.doList(Loader.java:2545)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
    at org.hibernate.loader.Loader.list(Loader.java:2271)
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
    at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
    at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
    at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
    at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:890)

有人可以调查一下并帮助我吗?

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping  DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
      <class mutable="false" name="com.adp.au.timesheet.external.PLClient">
        <id name="clientId"/>
         <property name="branch"/>
         <property name="name"/>
         <property name="timesheetType"/>
           <property name="costSplitting" type="yes_no"/>
         <property name="payconReportCode"/>
         <property name="ownEftUseInd" type="yes_no"/>
         <property name="essUse" type="integer"/>
     </class>
       <sql-query name="plClient.byClientId.forABAFile" read-only="true">
    <return alias="client" class="com.adp.au.timesheet.external.PLClient"/>
    SELECT
     TRIM(CLI_ID) AS {client.clientId},
     OWN_EFT_USE_IND AS {client.ownEftUseInd}
     FROM SAG.PL_CLI`
     WHERE (TRIM(PL_CLI.CEASED_DATE) IS NULL OR PL_CLI.CEASED_DATE    &gt;TO_CHAR(SYSDATE, 'YYYYMMDD'))
     AND PL_CLI.CLI_ID = RPAD(:clientId, 7)
        </sql-query>
  </hibernate-mapping>

0 个答案:

没有答案