使用mybatis-generator的分页查询selectByExampleWithBLOBs()报错,字段limitSize没有set方法

这是一个坑

当数据库表有text字段的时候,要想查询出带有text字段数据的时候,就要使用带有BLOBs的方法,这本来是没问题的。

但是在使用selectByExampleWithBLOBs()分页查询或者排序查询的时候,由于text字段的原因,selectByExampleWithBLOBs()分页排序查询会直接报错

解决:

正确的方法是先使用selectByExample()分页排序查询出没有text的其他字段,然后在通过遍历,使用id查询出包含text的字段

完整示例如下:

//先查询出没有text字段的其他数据
List roleList = roleMapper.selectByExample(example);

List roleVOList = new LinkedList<>();
for (Role role : roleList) {
//再通过id查找有text字段的对象
	Role = roleMapper.selectByPrimaryKey(rsysRole.getId());
	RoleVO roleVO = new RoleVO();
	roleVO.setId(role.getId());
	roleVO.setModules(role.getModules());
	roleVOList.add(roleVO);
}

 

你可能感兴趣的:(使用mybatis-generator的分页查询selectByExampleWithBLOBs()报错,字段limitSize没有set方法)