Lecturer +
This commit is contained in:
parent
8b5d73a5dd
commit
3c026115fe
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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<Lecturer, Long> {
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -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
|
Loading…
Reference in New Issue
Block a user