Role chairman = dao.fetch(Role.class, "Chairman");
User user = dao.fetch(User.class, "admin");
user.addRole(chairman);
dao.updateLinks(user,null);
这代码无法更新user_role映射表,日志也不报错,附addRole
public User addRole(Role role) {
if (this.roles == null) roles = new ArrayList<Role>();
roles.add(role);
return this;
}