hibernate中用到了
Query query=session.createQuery("select itemname from Item as item where  item.itemname=?");
          query.setString(0,itemname); //itemname假设传递的参数
             str = query.getQueryString();
但是 在action中取出来的str="select itemname from Item as item where  item.itemname=?"
而不是想要的字符串

解决方案 »

  1.   

    你要做什么啊,你是要运行结果吧??
    getQueryString只是说要得到你给定的查询语句啊!!!!!!!!
    你可以调用 uniqueResult() 返回相应的对象啊,另外你的查询语句可能不一定正确,如果Item是你的Hibernate中的POJO对象,应该写上包的名字不能只是写Item就算
    一般写成 from chdw.Service Service where name = ? 这样就行
      

  2.   

    但是 在action中取出来的str="select itemname from Item as item where  item.itemname=?"
    而不是想要的字符串--------------------------------那你到底要什么啊?
      

  3.   

    方法用错了!
    Query query = session.createQuery(sql);
    List lt = query.list();
    lt里面就是你要用的数据集
    不是用query.getQueryString();