Added enpoint /getCoursesWithGroups

This commit is contained in:
Filip Izydorczyk
2020-08-24 12:02:44 +02:00
parent 20e2cc9ea0
commit 186cccdd95
2 changed files with 34 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@ -16,7 +17,7 @@ public class Course {
private Long id;
private String name;
private String symbol;
@OneToMany(mappedBy = "id")
@OneToMany(mappedBy = "courseId", fetch = FetchType.EAGER)
private List<Groups> groups = new ArrayList<>();
public Course() {
@ -42,4 +43,8 @@ public class Course {
this.name = name;
}
public List<Groups> getGroups(){
return this.groups;
}
}