解决方案 »

  1.   

    很明显,把你的sql和参数连接起来看看,sql语句明显有问题啊,
    看你的sql像是分页查询,但是怎么会用到like关键字
      

  2.   

    调试看看就去没。。你for 里面的j 没用到啊
      

  3.   

    你现在循环外面遍历打印一下objs.toString看看是什么。
    还有打印为什么会出来%%,你把百分号也拼到了objs的对象里了?
      

  4.   


    我用的事模糊查询,但是objs中的数据进不去
      

  5.   

    你 i直接i<objs.length 
      

  6.   


    toString 的结果是一样的
      

  7.   

    %% 中间没值吧你的obj[i]里面是空字符串。
      

  8.   

    应该不是这个问题吧,两个位置上的值进不到hql里面
      

  9.   

    from UserPojo where uemail like ? and username like ?
    %123%
    %123%
    %123%
    %123%
    queryString: from UserPojo where uemail like ? and username like ?有值的时候也不行
      

  10.   

    你debug 进去看看具体的值,具体的信息。
      

  11.   


    语句的原型是
                    this.sql="from UserPojo where uemail like ? and username like ?";
    this.objs=new Object[]{"%"+uemail+"%","%"+username+"%"};
      

  12.   


    debug里面调试的时候objs里面的值都没有问题,但在执行色图parameter时值没有进去
      

  13.   

    为什么没set 进去,debug 你看下。objs 里面具体信息
      

  14.   


    不填数据时objs里面是[%%, %%]
    填了数据时是[%123%, %123%];
    在query中始终是from UserPojo where uemail like ? and username like ?
      

  15.   

    不知你怎么写 。写死看看 参照                        return session.createQuery("from xxx a where a.x like ? or a.xx like ? order by a.xx")  
                                            .setParameter(0, queryStr1 + "%")  
                                            .setParameter(1, queryStr 2+ "%")  
                                            .setFirstResult((pageNo - 1) * pageSize)  
                                            .setMaxResults(pageSize)  
                                              
                                            .list(); 
      

  16.   

    写死之后还是进不去
    结果还是
    from UserPojo where uemail like ? and username like ?queryString: from UserPojo where uemail like ? and username like ?queryString: from UserPojo where uemail like ? and username like ?Hibernate: select userpojo0_.id as id2_, userpojo0_.uemail as uemail2_, userpojo0_.password as password2_, userpojo0_.username as username2_, userpojo0_.uage as uage2_, userpojo0_.sex as sex2_, userpojo0_.roleid as roleid2_ from user userpojo0_ where (userpojo0_.uemail like ?) and (userpojo0_.username like ?) limit ?Hibernate: select count(*) as col_0_0_ from user userpojo0_ where (userpojo0_.uemail like ?) and (userpojo0_.username like ?)我不知道那个limit是啥意思了
      

  17.   

    没有值,但这个%%应该加入到hql语句里面才对,但就是进不去。
    除了配置问题,对数据库设计有没有啥特殊的要求啊,求解释
      

  18.   

    limit  是取数据条数。。你可以objs 你什么类型 的  还有数据库什么类型的?
    别用Object 用它本身类型试试看。  
      

  19.   

    我把类型改成String还是不行,数据库里面就是varchar.
    除了用setParameter方法之外还有那么比较好用啊
      

  20.   


    语句的原型是
                    this.sql="from UserPojo where uemail like ? and username like ?";
    this.objs=new Object[]{"%"+uemail+"%","%"+username+"%"};你这样不对,少单引号  this.objs=new Object[]{"   ' %"+uemail+"% '    ","  '  %"+username+"% '  "};
    百分号两边要有单引号~
      

  21.   

    http://blog.sina.com.cn/s/blog_6819fa800100jpfz.html 
    setParameter 是设置别名的一种形式,你的是?的型式 。
      

  22.   


    语句的原型是
                    this.sql="from UserPojo where uemail like ? and username like ?";
    this.objs=new Object[]{"%"+uemail+"%","%"+username+"%"};你这样不对,少单引号  this.objs=new Object[]{"   ' %"+uemail+"% '    ","  '  %"+username+"% '  "};
    百分号两边要有单引号~
    试过了,不是这的错.