sascha@1210: package de.intevation.flys.model;
sascha@1210: 
sascha@1210: import java.io.Serializable;
sascha@1210: 
sascha@1210: import java.math.BigDecimal;
sascha@1210: 
sascha@1217: import java.util.Date;
sascha@1210: import java.util.List;
sascha@1210: 
sascha@1210: import javax.persistence.Entity;
sascha@1210: import javax.persistence.Id;
sascha@1210: import javax.persistence.Table;
sascha@1210: import javax.persistence.GeneratedValue;
sascha@1210: import javax.persistence.Column;
sascha@1210: import javax.persistence.SequenceGenerator;
sascha@1210: import javax.persistence.GenerationType;
sascha@1210: import javax.persistence.OneToOne;
sascha@1210: import javax.persistence.OneToMany;
sascha@1210: import javax.persistence.OrderBy;
sascha@1210: import javax.persistence.JoinColumn;
sascha@1210: 
sascha@1210: @Entity
sascha@1210: @Table(name = "hyk_entries")
sascha@1210: public class HYKEntry
sascha@1210: implements   Serializable
sascha@1210: {
sascha@1210:     private Integer    id;
sascha@1210:     private HYK        hyk;
sascha@1210:     private BigDecimal km;
sascha@1217:     private Date       measure;
sascha@1210: 
sascha@1210:     private List<HYKFormation> formations;
sascha@1210: 
sascha@1210:     public HYKEntry() {
sascha@1210:     }
sascha@1210: 
sascha@1217:     public HYKEntry(HYK hyk, BigDecimal km, Date measure) {
sascha@1217:         this.hyk     = hyk;
sascha@1217:         this.km      = km;
sascha@1217:         this.measure = measure;
sascha@1210:     }
sascha@1210: 
sascha@1210:     @Id
sascha@1210:     @SequenceGenerator(
sascha@1210:         name           = "SEQUENCE_HYK_ENTRIES_ID_SEQ",
sascha@1210:         sequenceName   = "HYK_ENTRIES_ID_SEQ",
sascha@1210:         allocationSize = 1)
sascha@1210:     @GeneratedValue(
sascha@1210:         strategy  = GenerationType.SEQUENCE,
sascha@1210:         generator = "SEQUENCE_HYK_ENTRIES_ID_SEQ")
sascha@1210:     @Column(name = "id")
sascha@1210:     public Integer getId() {
sascha@1210:         return id;
sascha@1210:     }
sascha@1210: 
sascha@1210:     public void setId(Integer id) {
sascha@1210:         this.id = id;
sascha@1210:     }
sascha@1210: 
sascha@1210:     @OneToOne
sascha@1210:     @JoinColumn(name = "hyk_id")
sascha@1210:     public HYK getHYK() {
sascha@1210:         return hyk;
sascha@1210:     }
sascha@1210: 
sascha@1210:     public void setHYK(HYK hyk) {
sascha@1210:         this.hyk = hyk;
sascha@1210:     }
sascha@1210: 
sascha@1210:     @Column(name = "km")
sascha@1210:     public BigDecimal getKm() {
sascha@1210:         return km;
sascha@1210:     }
sascha@1210: 
sascha@1210:     public void setKm(BigDecimal km) {
sascha@1210:         this.km = km;
sascha@1210:     }
sascha@1210: 
sascha@1217:     @Column(name = "measure")
sascha@1217:     public Date getMeasure() {
sascha@1217:         return measure;
sascha@1217:     }
sascha@1217: 
sascha@1217:     public void setMeasure(Date measure) {
sascha@1217:         this.measure = measure;
sascha@1217:     }
sascha@1217: 
sascha@1210:     @OneToMany
ingo@1222:     @OrderBy("formationNum")
sascha@1210:     @JoinColumn(name="hyk_entry_id")
sascha@1210:     public List<HYKFormation> getFormations() {
sascha@1210:         return formations;
sascha@1210:     }
sascha@1210: 
sascha@1210:     public void setFormations(List<HYKFormation> formations) {
sascha@1210:         this.formations = formations;
sascha@1210:     }
sascha@1210: }
sascha@1210: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :