Guest User

Untitled

a guest
Jan 20th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. @Entity
  2. class Student{
  3. @Id
  4. private Long id;
  5. @OneToMany(mappedBy = "student",
  6. cascade = { CascadeType.PERSIST, CascadeType.MERGE,
  7. CascadeType.REFRESH })
  8. private List<Attendance> attendances;
  9. }
  10.  
  11. @Entity
  12. class Attendance{
  13.  
  14. @ManyToOne
  15. @JoinColumn(name = "id")
  16. private Student student;
  17. }
  18.  
  19. select P.id, N from Student s left join s.attendances, IN(s.attendances) as N;
Add Comment
Please, Sign In to add comment