在许多中,仅获得id而不是整个对象

public class Role {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
 @ManyToMany(cascade = {CascadeType.REFRESH, CascadeType.MERGE}, fetch = FetchType.LAZY)
@JoinTable(name = "user_to_role",
        joinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id"),
        inverseJoinColumns = @JoinColumn(name = "user_id",referencedColumnName = "id"))
private Set<User> users;
}

public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
  @ManyToMany(cascade = {CascadeType.REFRESH, CascadeType.MERGE})
@JoinTable(name = "user_to_role",
        joinColumns = @JoinColumn(name = "user_id"),
        inverseJoinColumns = @JoinColumn(name = "role_id"))
private Set<Role> roles;
}

我在两个班级之间有很多对很多的关系。调用role.getUsers()时,我只想获取用户ID,其余字段应忽略,因为会有很多数据,而且我不想加载所有内容,如何实现呢?