diff --git a/buisnesslogic/src/main/java/com/plannaplan/entities/Groups.java b/buisnesslogic/src/main/java/com/plannaplan/entities/Groups.java index 4f1aa7d..7f4b6ea 100644 --- a/buisnesslogic/src/main/java/com/plannaplan/entities/Groups.java +++ b/buisnesslogic/src/main/java/com/plannaplan/entities/Groups.java @@ -4,6 +4,8 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; import com.plannaplan.types.GroupType; import com.plannaplan.types.WeekDay; @@ -19,10 +21,21 @@ public class Groups { private int capacity; private GroupType type; private WeekDay day; + @ManyToOne + @JoinColumn(name = "lecturer_id") + private Lecturer lecturer; public Groups() { } + public Lecturer getLecturer() { + return lecturer; + } + + public void setLecturer(Lecturer lecturer) { + this.lecturer = lecturer; + } + public WeekDay getDay() { return day; } diff --git a/buisnesslogic/src/main/java/com/plannaplan/entities/Lecturer.java b/buisnesslogic/src/main/java/com/plannaplan/entities/Lecturer.java new file mode 100644 index 0000000..61d5e9a --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/entities/Lecturer.java @@ -0,0 +1,44 @@ +package com.plannaplan.entities; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Lecturer { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + private String title; + private String name; + private String surname; + + public Lecturer() { + } + + public String getTitle() { + return title; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public void setTitle(String title) { + this.title = title; + } + +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/repositories/LecturerRepository.java b/buisnesslogic/src/main/java/com/plannaplan/repositories/LecturerRepository.java new file mode 100644 index 0000000..1651bdb --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/repositories/LecturerRepository.java @@ -0,0 +1,12 @@ +package com.plannaplan.repositories; + +import com.plannaplan.entities.Lecturer; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository + +public interface LecturerRepository extends JpaRepository { + +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/services/LecturerService.java b/buisnesslogic/src/main/java/com/plannaplan/services/LecturerService.java new file mode 100644 index 0000000..3b2de4b --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/services/LecturerService.java @@ -0,0 +1,12 @@ +package com.plannaplan.services; + +import com.plannaplan.repositories.LecturerRepository; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class LecturerService { + @Autowired + LecturerRepository repo; +} \ No newline at end of file diff --git a/restservice/src/main/resources/application.properties b/restservice/src/main/resources/application.properties index d7a0cf8..309a6b7 100644 --- a/restservice/src/main/resources/application.properties +++ b/restservice/src/main/resources/application.properties @@ -4,7 +4,7 @@ spring.datasource.username=root spring.datasource.password=example spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.jpa.open-in-view=true -spring.jpa.hibernate.ddl-auto=create +spring.jpa.hibernate.ddl-auto=create-drop spring.jackson.serialization.fail-on-empty-beans=false server.port=1285 \ No newline at end of file