package com.jasamedika.medifirst2000.entities; import com.fasterxml.jackson.annotation.JsonManagedReference; import com.jasamedika.medifirst2000.base.BaseTransaction; import com.jasamedika.medifirst2000.helper.Caption; import lombok.Getter; import lombok.Setter; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.util.Date; import java.util.HashSet; import java.util.Set; import static javax.persistence.CascadeType.ALL; import static javax.persistence.FetchType.LAZY; @Getter @Setter @Entity @Table(name = "KecelakaanKerja_T") public class KecelakaanKerja extends BaseTransaction { @Column(name = "tglInsiden", nullable = false) @Caption(value = "Tanggal Insiden") @NotNull(message = "Tanggal Insiden tidak boleh kosong") private Date tglInsiden; @Column(name = "waktuInsiden", nullable = false) @Caption(value = "Waktu Insiden") @NotNull(message = "Waktu Insiden tidak boleh kosong") private Date waktuInsiden; @Column(name = "pekerjaan") @Caption(value = "Pekerjaan") private String pekerjaan; @Column(name = "lokasi") @Caption(value = "Lokasi") private String lokasi; @Column(name = "area") @Caption(value = "Area") private String area; @Column(name = "Kronologi") @Caption(value = "Kronologi") private String kronologi; @Column(name = "kerugianAset") @Caption(value = "Kerugian Aset") private String kerugianAset; @Column(name = "kerugianLingkungan") @Caption(value = "Kerugian Lingkungan") private String kerugianLingkungan; @JsonManagedReference @OneToMany(cascade = ALL, fetch = LAZY, mappedBy = "kecelakaanKerja") @Caption(value = "korbanSet") private Set korbanSet = new HashSet<>(); @JsonManagedReference @OneToMany(cascade = ALL, fetch = LAZY, mappedBy = "kecelakaanKerja") @Caption(value = "tindakanSet") private Set tindakanKeselamatanKerja = new HashSet<>(); @JsonManagedReference @OneToMany(cascade = ALL, fetch = LAZY, mappedBy = "kecelakaanKerja") @Caption(value = "saksiSet") private Set saksiSet = new HashSet<>(); }