JPA Example查询

//创建查询条件数据对象
        Customer customer = new Customer();
        customer.setAddress("河南省郑州市");
        customer.setFocus(true);
        
        //创建实例
        Example<Customer> ex = Example.of(customer); 
        
        //查询
        List<Customer> ls = dao.findAll(ex);
        
        //输出结果
        System.out.println("数量:"+ls.size());
        for (Customer bo:ls)
        {
            System.out.println(bo.getName());
        }
posted @ 2017-10-27 16:59  涉谷猫猫  阅读(1909)  评论(0编辑  收藏  举报