Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. select * from other_table a where a.fk_id = {id} and arbitrary other predicates
  2.  
  3. @Entity
  4. public class Employee {
  5. @Id
  6. @Column(name="EMP_ID")
  7. private long id;
  8. ...
  9. @OneToMany(mappedBy="owner")
  10. private List<Phone> phones;
  11. ...
  12. }
  13.  
  14. @Entity
  15. public class Employee {
  16. @Id
  17. @Column(name="EMP_ID")
  18. private long id;
  19. ...
  20. @OneToMany(mappedBy="owner")
  21. private List<Phone> phonesInAreaCode212; // only NYC phone numbers
  22.  
  23. @OneToMany(mappedBy="owner")
  24. private List<Phone> phonesInAreaCode202; // only DC phone numbers
  25.  
  26. @OneToMany(mappedBy="owner")
  27. private List<Phone> phonesInOtherAreaCodes; // areaCode not in ('212', '202')
  28. ...
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement