2021-01-07 11:34:56 +07:00

169 lines
4.5 KiB
Java

package com.jasamedika.medifirst2000.entities;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.jasamedika.medifirst2000.base.BaseMaster;
import com.jasamedika.medifirst2000.helper.Caption;
import org.hibernate.envers.Audited;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
* class DesaKelurahan
*
* @author Generator
*/
@Entity // @Audited
@Table(name = "DesaKelurahan_M")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class DesaKelurahan extends BaseMaster {
@NotNull(message = "Kd Desa Kelurahan tidak boleh kosong")
@Column(name = "KdDesaKelurahan", nullable = false)
@Caption(value = "Kode Desa Kelurahan")
private Integer kdDesaKelurahan;
public void setKdDesaKelurahan(Integer kdDesaKelurahan) {
this.kdDesaKelurahan = kdDesaKelurahan;
}
public Integer getKdDesaKelurahan() {
return this.kdDesaKelurahan;
}
@ManyToOne(fetch = FetchType.LAZY)
@Fetch(FetchMode.JOIN)
@JoinColumn(name = "ObjectKecamatanFk")
@NotNull(message = "Kd Kecamatan tidak boleh kosong")
@Caption(value = "Object Kecamatan")
private Kecamatan kecamatan;
public void setKecamatan(Kecamatan kecamatan) {
this.kecamatan = kecamatan;
}
public Kecamatan getKecamatan() {
return this.kecamatan;
}
@Column(name = "ObjectKecamatanFk", insertable = false, updatable = false)
private Integer kecamatanId;
@ManyToOne
@JoinColumn(name = "ObjectKotaKabupatenFk")
@NotNull(message = "Kd Kota Kabupaten tidak boleh kosong")
@Caption(value = "Object Kota Kabupaten")
private KotaKabupaten kotaKabupaten;
public void setKotaKabupaten(KotaKabupaten kotaKabupaten) {
this.kotaKabupaten = kotaKabupaten;
}
public KotaKabupaten getKotaKabupaten() {
return this.kotaKabupaten;
}
@Column(name = "ObjectKotaKabupatenFk", insertable = false, updatable = false, nullable = false)
private Integer kotaKabupatenId;
@ManyToOne
@JoinColumn(name = "ObjectPropinsiFk")
@NotNull(message = "Kd Propinsi tidak boleh kosong")
@Caption(value = "Object Propinsi")
private Propinsi propinsi;
public void setPropinsi(Propinsi propinsi) {
this.propinsi = propinsi;
}
public Propinsi getPropinsi() {
return this.propinsi;
}
@Column(name = "ObjectPropinsiFk", insertable = false, updatable = false, nullable = false)
private Integer propinsiId;
@Caption(value = "Kode Pos")
private String kodePos;
@Column(name = "KodePos", nullable = true, length = 10)
public String getKodePos() {
return kodePos;
}
public void setKodePos(String kodePos) {
this.kodePos = kodePos;
}
@NotNull(message = "Nama Desa Kelurahan tidak boleh kosong")
@Column(name = "NamaDesaKelurahan", nullable = false, length = 50)
@Caption(value = "Nama Desa Kelurahan")
private String namaDesaKelurahan;
public void setNamaDesaKelurahan(String namaDesaKelurahan) {
this.namaDesaKelurahan = namaDesaKelurahan;
}
public String getNamaDesaKelurahan() {
return this.namaDesaKelurahan;
}
@NotNull(message = "QDesa Kelurahan tidak boleh kosong")
@Column(name = "QDesaKelurahan", nullable = false)
@Caption(value = "QDesa Kelurahan")
private Integer qDesaKelurahan;
public void setqDesaKelurahan(Integer qDesaKelurahan) {
this.qDesaKelurahan = qDesaKelurahan;
}
public Integer getqDesaKelurahan() {
return this.qDesaKelurahan;
}
/*
* @JsonManagedReference
*
* @OneToMany(fetch=FetchType.LAZY, cascade = CascadeType.ALL,
* mappedBy="kddesakelurahan") private Set<Alamat> AlamatSet = new
* HashSet<Alamat>();
*
* public Set<Alamat> getAlamatSet() { return AlamatSet; }
*
* public void setAlamatSet(Set<Alamat> alamatSet) { AlamatSet = alamatSet;
* }
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "public.desakelurahan_m_id_seq")
@javax.persistence.SequenceGenerator(name = "public.desakelurahan_m_id_seq", sequenceName = "public.desakelurahan_m_id_seq", allocationSize = 1)
@Column(name = "id")
protected Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}