我有三种模式:
@Entity
public class Role extends Model {
@Required
public String machineryName;
// ...
}
public class User extends Model {
// ...
@ManyToOne
public Role role;
// ...
}
@Entity
public class Hall extends Model {
// ...
@ManyToMany(cascade=CascadeType.DETACH)
public Set<User> waiters = new HashSet<User>();
// ...
}
现在我希望所有用户都拥有角色“服务员”(machineryName)并与特定大厅相关联。你能帮助我吗?感谢。
答案 0 :(得分:1)
如果你正在使用游戏,你的orm可能会休眠。如果是这样,您可以查看过滤:
Filter list contained in entity returned by jpa/hibernate query或http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/filters.html