使用一个map映射出两个对象,再把两者关系对应起来

        String sql = "select * from book where bid =?";
            Map<String,Object> map = qr.query(sql, new MapHandler(),bid);
            //return qr.query(sql, new BeanHandler<Book>(Book.class),bid);
            
            /*
             * 使用一个map映射出两个对象,再把两者关系对应起来 
             */
            Category category = CommonUtils.toBean(map, Category.class);
            Book book = CommonUtils.toBean(map, Book.class);
            book.setCategory(category);
原文地址:https://www.cnblogs.com/xiaoxiao5ya/p/4942920.html