sascha@167: package de.intevation.flys.model; sascha@167: sascha@167: import java.io.Serializable; sascha@167: sascha@168: import javax.persistence.Entity; sascha@168: import javax.persistence.Id; sascha@168: import javax.persistence.Table; sascha@168: import javax.persistence.GeneratedValue; sascha@168: import javax.persistence.Column; sascha@168: import javax.persistence.SequenceGenerator; sascha@174: import javax.persistence.OneToMany; sascha@174: import javax.persistence.JoinColumn; sascha@168: import javax.persistence.GenerationType; sascha@168: sascha@174: import java.util.List; sascha@174: sascha@168: @Entity sascha@168: @Table(name = "rivers") sascha@167: public class River sascha@167: implements Serializable sascha@167: { sascha@168: private Integer id; sascha@167: sascha@168: private String name; sascha@167: sascha@174: private List gauges; sascha@174: sascha@168: @Id sascha@168: @SequenceGenerator( sascha@171: name = "SEQUENCE_RIVERS_ID_SEQ", sascha@169: sequenceName = "RIVERS_ID_SEQ", sascha@169: allocationSize = 1) sascha@168: @GeneratedValue( sascha@168: strategy = GenerationType.SEQUENCE, sascha@171: generator = "SEQUENCE_RIVERS_ID_SEQ") sascha@168: @Column(name = "id") sascha@168: public Integer getId() { sascha@168: return id; sascha@168: } sascha@168: sascha@168: public void setId(Integer id) { sascha@167: this.id = id; sascha@167: } sascha@167: sascha@168: @Column(name = "name") sascha@168: public String getName() { sascha@168: return name; sascha@167: } sascha@167: sascha@167: public void setName(String name) { sascha@167: this.name = name; sascha@167: } sascha@167: sascha@167: public River() { sascha@167: } sascha@169: sascha@169: public River(String name) { sascha@169: this.name = name; sascha@169: } sascha@174: sascha@174: @OneToMany sascha@174: @JoinColumn(name="river_id") sascha@174: public List getGauges() { sascha@174: return gauges; sascha@174: } sascha@174: sascha@174: public void setGauges(List gauges) { sascha@174: this.gauges = gauges; sascha@174: } sascha@188: sascha@188: public String toString() { sascha@188: return name != null ? name : ""; sascha@188: } sascha@167: } sascha@167: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :