Commit 09f42185 authored by Muhammad Suleman's avatar Muhammad Suleman

Added Section Service

parent 6c2d7aee
......@@ -41,5 +41,6 @@ public class Course {
private Set<Teacher> teacherList;
@OneToMany(mappedBy = "course",cascade = CascadeType.ALL,fetch = FetchType.LAZY)
@JsonIgnore
private List<Assessment> assessment;
}
......@@ -36,10 +36,8 @@ public class Assessment {
@JsonIgnore
private Course course;
@OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY,orphanRemoval = true)
@JoinTable(name = "assessment_sections",
joinColumns = {@JoinColumn(name = "assessment_id")},
inverseJoinColumns = {@JoinColumn(name = "section_id")})
@OneToMany(mappedBy = "assessment",fetch = FetchType.LAZY)
@JsonIgnore
private List<Section> section;
}
......@@ -6,6 +6,7 @@ import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.util.Set;
@Getter
@Setter
......@@ -28,13 +29,14 @@ public class Section {
@ManyToOne(fetch = FetchType.LAZY)
@JoinTable(name = "assessment_sections",
joinColumns = {@JoinColumn(name = "assessment_id",insertable = false,updatable = false)},
inverseJoinColumns = {@JoinColumn(name = "section_id",insertable = false,updatable = false)})
joinColumns = {@JoinColumn(name = "section_id")},
inverseJoinColumns = {@JoinColumn(name = "assessment_id")})
@JsonIgnore
private Assessment assessment;
@OneToOne(mappedBy = "section",cascade = CascadeType.ALL,fetch = FetchType.LAZY)
@OneToMany(mappedBy = "section",cascade = CascadeType.ALL,fetch = FetchType.LAZY)
@JsonIgnore
private StudentMarks studentMarks;
private Set<StudentMarks> studentMarks;
}
......@@ -26,7 +26,7 @@ public class StudentMarks {
@NotNull
private Student student;
@OneToOne(fetch = FetchType.LAZY,cascade = CascadeType.ALL)
@ManyToOne(fetch = FetchType.LAZY,cascade = CascadeType.ALL)
@JoinColumn(name = "section_id")
@NotNull
private Section section;
......
......@@ -2,7 +2,8 @@
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/school-portal
spring.datasource.username=root
spring.datasource.password=charlie123
spring.datasource.password=root
spring.security.user.name= sulemantalpur6@gmail.com
spring.security.user.password=charlie
......@@ -12,4 +13,4 @@ spring.mvc.view.prefix=/static
server.error.include-message=always
spring.datasource.data=data.sql
\ No newline at end of file
spring.datasource.data=classpath:data.sql
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment