String sql = "Select a.V_MOBILE mobile, a.V_CLIENT_NAME clientname, a.V_CERTIFICATE_TYPE certificatetype, a.V_CERTIFICATE_NO certificateno, a.V_AREA area, V_CITY city, a.V_BUSINESS_HALL businesshall, a.D_OPEN_ACCOUT openaccout, a.V_ADDRESS address, b.V_NAME brandname, c.V_NAME viplevelname, a.N_INTEGRAL integral from vip_user_info a join sys_dictionary b on a.n_brand = b.n_id join sys_dictionary c on a.n_vip_level=c.n_id where 1=1";SQLQuery sqlQuery = session.createSQLQuery(sql).addEntity(UserInfo.class);一加实体就报错没加实体就没错

解决方案 »

  1.   

    你加实体加在哪里? 应该有一个问号的地方吧 我只看见你的 where 1=1 为什么要写这个啊???等于没写啊
      

  2.   

    from vip_user_info a join sys_dictionary b on a.n_brand = b.n_id join sys_dictionary c on a.n_vip_level=c.n_id where 1=1";
    改成
    from vip_user_info a,sys_dictionary b,sys_dictionary c where  a.n_brand = b.n_id and a.n_vip_level=c.n_id 
    供参考...
      

  3.   

    你的PO的字段和SQL的字段是否匹配
      

  4.   

    这位兄弟说的对,UserInfo的成员必须要和sql中的字段一样
    还有,也可以用map的方式map<columnname,value>这样的形式