我在休眠 像@ManyToMany關係: Employee表多對多檢索標準
public class Employee implements Serializable {
@ManyToMany(fetch = FetchType.EAGER)
@Fetch(FetchMode.SELECT)
@JoinTable(name = "employee_role", joinColumns = { @JoinColumn(name = "employee_id") }, inverseJoinColumns = { @JoinColumn(name = "role_id") })
private Set<Role> roles = new HashSet<Role>(0);
}
表角色:
public class Role implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Column(name = "role_id", unique = true, nullable = false)
@Basic(fetch = FetchType.EAGER)
private long id;
}
如何讓全體員工當角色被休眠有一個特定的值標準 或子查詢