Teacher

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.3 kB
1
Indexable
Never
package com.example.elektronski_dnevnik.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.time.LocalDate;
import java.util.Set;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Access(AccessType.FIELD)
public class TeacherEntity extends Person {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "teacher_id")
    private Integer teacherId;
    @Lob
    private byte[] photo;
    @JsonIgnore
    @OneToMany(mappedBy = "teacher", cascade = CascadeType.ALL)
    private Set<TeacherSubjectEntity> teacherSubjects;

    /*
        todo: popravi ovo ispod!
     */
    @OneToOne(mappedBy = "homeroomTeacher")
    private ClassEntity homeroomClass;

    public TeacherEntity(String firstName, String lastName, String email, String address, String phoneNumber, LocalDate birthDate) {
        setFirstName(firstName);
        setLastName(lastName);
        setEmail(email);
        setAddress(address);
        setPhoneNumber(phoneNumber);
        setDateOfBirth(birthDate);

    }
}
Leave a Comment