Subject

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

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

import java.util.LinkedHashSet;
import java.util.Set;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
public class SubjectEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "subject_id")
    private Integer subjectId;
    @Column(name = "subject_name")
    private String subjectName;
    @Column(name = "lesson_total")
    private Integer lessonTotal;
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "razred_id")
    @JsonManagedReference
    private RazredEntity razred;
    @OneToMany(mappedBy = "subject")
    private Set<TeacherSubjectEntity> teacherSubjects;
    @OneToMany(mappedBy = "subject")
    private Set<FinalGradeEntity> finalGrades = new LinkedHashSet<>();
    @Version
    private Integer version;
}
Leave a Comment