hs.hsadmin/hsarback/src/de/hsadmin/mods/pac/PacComponent.java

108 lines
2.2 KiB
Java
Raw Normal View History

2010-10-01 21:52:51 +02:00
package de.hsadmin.mods.pac;
import static javax.persistence.FetchType.EAGER;
import java.io.Serializable;
import java.util.Date;
2010-10-06 15:06:01 +02:00
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
2010-10-01 21:52:51 +02:00
import javax.persistence.IdClass;
2010-10-06 15:06:01 +02:00
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity(name = "PacComponents")
@Table(name = "packet_component")
2010-10-01 21:52:51 +02:00
@IdClass(PacComponentId.class)
public class PacComponent implements Serializable {
private static final long serialVersionUID = 5359873462163274873L;
2010-10-06 15:06:01 +02:00
@Id
2010-10-01 21:52:51 +02:00
private Pac pac;
2010-10-06 15:06:01 +02:00
@Id
2010-10-01 21:52:51 +02:00
private BaseComponent baseComponent;
2010-10-06 15:06:01 +02:00
@JoinColumn(name = "basepacket_id", columnDefinition = "integer", nullable = false)
@ManyToOne(fetch = EAGER)
2010-10-01 21:52:51 +02:00
private BasePac basePac;
2010-10-06 15:06:01 +02:00
@Column(name = "quantity", columnDefinition = "integer")
2010-10-01 21:52:51 +02:00
private int quantity;
2010-10-06 15:06:01 +02:00
@Column(name = "created", columnDefinition = "date", nullable = true)
@Temporal(TemporalType.DATE)
2010-10-01 21:52:51 +02:00
private Date created;
2010-10-06 15:06:01 +02:00
@Column(name = "cancelled", columnDefinition = "date", nullable = true)
@Temporal(TemporalType.DATE)
2010-10-01 21:52:51 +02:00
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;
}
}