String hql ="select strTermNum, strPan, cardType, amount, hostTransStatus, termTransStatus, strHostTsn, strTermTsn, dtOccur, settleCycle, fee, singStatus, cardTypeBasic  from TransLogDeposit where hostTransStatus="+hostTransStatus;Query query = session.createQuery(hql);
resultList = query.list();
这样更简单把。

解决方案 »

  1.   

    amazeur(无知) 高手这样是很简单
    但是我想解决的是为什么程序执行不到resultList = query.list();这一步呢?
      

  2.   

    是写的hql有问题把,你先写个String hql ="from TransLogDeposit where hostTransStatus="+hostTransStatus;测试一下,把所有字段都查出来看看。
      

  3.   

    String hql ="from TransLogDeposit t where t.hostTransStatus="+hostTransStatus";
      

  4.   

    String hql ="from TransLogDeposit t where t.hostTransStatus="+hostTransStatus;
      

  5.   

    String hql ="select cc.strTermNum, cc.strPan, cc.cardType, cc.amount, cc.hostTransStatus, cc.termTransStatus, cc.strHostTsn, cc.strTermTsn, cc.dtOccur, cc.settleCycle, cc.fee, cc.singStatus, cc.cardTypeBasic  from TransLogDeposit as cc where cc.hostTransStatus=:hostTransStatus";
    改成这样试试
      

  6.   

    Parameter hostTransStatus does not exist as a named parameter in [select strTermNum, strPan, cardType, amount, hostTransStatus, termTransStatus, strHostTsn, strTermTsn, dtOccur, settleCycle, fee, singStatus, cardTypeBasic  from TransLogDeposit where hostTransStatus=1]
    变成这个了
    是不是我数据库中的字段和SQL中的不一致阿?数据库中多了个"i":ihostTransStatus
      

  7.   

    这个问你啊。数据库字段名肯定要跟SQL、映射文件里的一致
      

  8.   

    在HBM.XML中名字可以不一致的阿