Guest User

Untitled

a guest
Jan 6th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. select * from mydb.goal g
  2. JOIN mydb.matches m
  3. ON g.goal_match = m.matchid
  4. JOIN mydb.competitions c
  5. ON m.competition = c.competitionid
  6. WHERE c.competitionid = 219;
  7.  
  8. @Entity
  9. public class Goal {
  10.  
  11. @Id
  12. private long idgoal;
  13. @ManyToOne(optional = false, fetch = FetchType.LAZY)
  14. @JoinColumn(name = "goalMatch")
  15. private Match goalMatch;
  16.  
  17. public long getIdgoal() {
  18. return idgoal;
  19. }
  20.  
  21. public void setIdgoal(long idgoal) {
  22. this.idgoal = idgoal;
  23. }
  24.  
  25. public Match getGoalMatch() {
  26. return goalMatch;
  27. }
  28.  
  29. public void setGoalMatch(Match goalMatch) {
  30. this.goalMatch = goalMatch;
  31. }
  32.  
  33. }
  34.  
  35. @Entity(name = "matches")
  36. public class Match {
  37.  
  38. @Id
  39. @GeneratedValue
  40. private long idmatch;
  41. @ManyToOne(optional = false, fetch = FetchType.LAZY)
  42. @JoinColumn(name = "competition")
  43. private Competition competition;
  44.  
  45. public long getIdmatch() {
  46. return idmatch;
  47. }
  48.  
  49. public void setIdmatch(long idmatch) {
  50. this.idmatch = idmatch;
  51. }
  52.  
  53. public Competition getCompetition() {
  54. return competition;
  55. }
  56.  
  57. public void setCompetition(Competition competition) {
  58. this.competition = competition;
  59. }
  60.  
  61. }
  62.  
  63. @Entity(name = "competitions")
  64. public class Competition {
  65.  
  66. @Id
  67. private Long idcompetitions;
  68.  
  69. public Long getIdcompetitions() {
  70. return idcompetitions;
  71. }
  72. public void setIdcompetitions(Long idcompetitions) {
  73. this.idcompetitions = idcompetitions;
  74. }
  75. }
Add Comment
Please, Sign In to add comment