码迷,mamicode.com
首页 > 移动开发 > 详细

关于datagrid查询时,封装了pojo对象,该对象必须要有一个带参数的构造器,否则会报错Unable to locate appropriate constructor on class

时间:2016-12-08 02:31:25      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:ring   pagebean   join   int   count   datagrid   method   out   page   

----------------------------------------------------------

实体类中

public CategoryBeanPojo(Integer id, String type, Boolean hot, String login,
            String name, String pass, Integer aid) {
        super();
        this.id = id;
        this.type = type;
        this.hot = hot;
        this.login = login;
        this.name = name;
        this.pass = pass;
        this.aid = aid;
    }

--------------------------------------------------------------------------

dao中

public List<CategoryBeanPojo> queryJoinAccount(CategoryBeanPojo category,
            PageBean pageBean) throws Exception{
        // TODO Auto-generated method stub
        StringBuffer sub=new StringBuffer();
        //sub.append("select ");
        sub.append("select new cn.it.shop.pojo.CategoryBeanPojo(c.id as id,");
        sub.append("c.type as type,");
        sub.append("c.hot as hot,");
        sub.append("(select a.login from Account as a where a.id=c.aid ) as login,");
        sub.append("(select a.name from Account as a where c.aid=a.id) as name, ");
        sub.append("(select a.pass from Account as a where c.aid=a.id) as pass,");
        sub.append("c.aid ");
        sub.append(" ) from Category as c where 1=1");
        sub.append(" and c.type like ‘%");
        if (category.getType()!=null) {
            sub.append(category.getType());
        }
        sub.append("%‘");
        System.out.println(sub.toString());
        return pageQuery(sub.toString(), pageBean);
    }

关于datagrid查询时,封装了pojo对象,该对象必须要有一个带参数的构造器,否则会报错Unable to locate appropriate constructor on class

标签:ring   pagebean   join   int   count   datagrid   method   out   page   

原文地址:http://www.cnblogs.com/yuanlp/p/6143296.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!