有如下user对象,想用分页查询User对象的时候也能把roles查出来,请问除了先查list再循环之外,有什么其他办法吗?
@Id
private Long id;
@Name
private String username;
private String password;
@ManyMany(relation="sys_user_roles",
from="sys_user_id",
to="roles_id")
private List<SysRole> roles;