Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select * from other_table a where a.fk_id = {id} and arbitrary other predicates
- @Entity
- public class Employee {
- @Id
- @Column(name="EMP_ID")
- private long id;
- ...
- @OneToMany(mappedBy="owner")
- private List<Phone> phones;
- ...
- }
- @Entity
- public class Employee {
- @Id
- @Column(name="EMP_ID")
- private long id;
- ...
- @OneToMany(mappedBy="owner")
- private List<Phone> phonesInAreaCode212; // only NYC phone numbers
- @OneToMany(mappedBy="owner")
- private List<Phone> phonesInAreaCode202; // only DC phone numbers
- @OneToMany(mappedBy="owner")
- private List<Phone> phonesInOtherAreaCodes; // areaCode not in ('212', '202')
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement