Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/model/River.java @ 168:86a1bd9cc50e
More Hibernate/JPA stuff
flys-backend/trunk@1458 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 11 Mar 2011 14:41:18 +0000 |
parents | 15d515fe15f5 |
children | 7929f4144d2f |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/model/River.java Thu Mar 10 13:44:51 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/River.java Fri Mar 11 14:41:18 2011 +0000 @@ -2,29 +2,49 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; + +import javax.persistence.GenerationType; + +@Entity +@Table(name = "rivers") public class River implements Serializable { - private Long id; + private Integer id; - private String name; + private String name; - public void setId(Long id) { + @Id + @SequenceGenerator( + name = "SEQUENCE RIVERS_ID_SEQ", + sequenceName = "RIVERS_ID_SEQ") + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE RIVERS_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + + public void setId(Integer id) { this.id = id; } - public Long getId() { - return id; + @Column(name = "name") + public String getName() { + return name; } public void setName(String name) { this.name = name; } - public String getName() { - return name; - } - public River() { } }