package de.hsadmin.mods.pac; import static javax.persistence.FetchType.EAGER; import java.io.Serializable; import java.util.Date; import javax.persistence.IdClass; @javax.persistence.Entity(name = "PacComponents") @javax.persistence.Table(name = "packet_component") @IdClass(PacComponentId.class) public class PacComponent implements Serializable { private static final long serialVersionUID = 5359873462163274873L; @javax.persistence.Id private Pac pac; @javax.persistence.Id private BaseComponent baseComponent; @javax.persistence.JoinColumn(name = "basepacket_id", columnDefinition = "integer", nullable = false) @javax.persistence.ManyToOne(fetch = EAGER) private BasePac basePac; @javax.persistence.Column(name = "quantity", columnDefinition = "integer") private int quantity; @javax.persistence.Column(name = "created", columnDefinition = "date", nullable = true) @javax.persistence.Temporal(javax.persistence.TemporalType.DATE) private Date created; @javax.persistence.Column(name = "cancelled", columnDefinition = "date", nullable = true) @javax.persistence.Temporal(javax.persistence.TemporalType.DATE) private Date cancelled; public PacComponent() { } public PacComponent(BasePac basePac, BaseComponent baseComp, Pac pac, int quantity, Date created, Date cancelled) { this.basePac = basePac; this.pac = pac; this.baseComponent = baseComp; this.quantity = quantity; this.created = created; this.cancelled = cancelled; } public BasePac getBasePac() { return basePac; } public void setbasePac(BasePac basePac) { this.basePac = basePac; } public BaseComponent getBaseComponent() { return baseComponent; } public void setBaseComponent(BaseComponent baseComponent) { this.baseComponent = baseComponent; } public Pac getPac() { return pac; } public void setPac(Pac pac) { this.pac = pac; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } public Date getCreated() { return created; } public void setCreated(Date created) { this.created = created; } public Date getCancelled() { return cancelled; } public void setCancelled(Date cancelled) { this.cancelled = cancelled; } }