JPA OneToMany集合的条件
- 论坛
- JPA OneToMany集合的条件
9 浏览
JPA OneToMany集合的条件
如果我有这个实体:
@Entity class Pet { @Id long id; public enum State { ALIVE, DEAD } @Enumerated(EnumType.STRING) @... State state; @... String name; }
我能创建这样的映射吗:
@Entity class Owner { @OneToMany(condition="state = ALIVE") // 或者类似的条件 SetalivePets; @OneToMany(condition="state = DEAD") Set deadPets; }