Mercurial > lada > lada-server
changeset 198:2eab59ea015e
Changed LKommentarP object not to use an embedded id.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 01 Jul 2013 17:08:29 +0200 |
parents | 5fb0fe4a55a9 |
children | 585013ccc961 |
files | src/main/java/de/intevation/lada/model/LKommentarP.java src/main/java/de/intevation/lada/model/LKommentarPId.java |
diffstat | 2 files changed, 13 insertions(+), 90 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/model/LKommentarP.java Mon Jul 01 15:20:23 2013 +0200 +++ b/src/main/java/de/intevation/lada/model/LKommentarP.java Mon Jul 01 17:08:29 2013 +0200 @@ -3,17 +3,12 @@ // Generated 21.05.2013 16:58:30 by Hibernate Tools 3.4.0.CR1 import java.util.Date; -import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; + import javax.persistence.Column; -import javax.persistence.EmbeddedId; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; @@ -24,10 +19,11 @@ */ @Entity @Table(name = "l_kommentar_p", schema = "public") +@SequenceGenerator(name = "ID_STORE", sequenceName = "l_kommentar_p_id_seq") public class LKommentarP implements java.io.Serializable { - private Integer kId; private String probeId; + private int kId; private String erzeuger; private Date KDatum; private String KText; @@ -35,16 +31,16 @@ public LKommentarP() { } - public LKommentarP(Integer kId, String probeId, String erzeuger, - Date KDatum) { - this.kId = kId; + public LKommentarP(int kId, String probeId, + String erzeuger, Date KDatum) { + this.kId =kId; this.probeId = probeId; this.erzeuger = erzeuger; this.KDatum = KDatum; } - public LKommentarP(Integer kId, String probeId, String erzeuger, - Date KDatum, String KText) { + public LKommentarP(int kId, String probeId, + String erzeuger, Date KDatum, String KText) { this.kId = kId; this.probeId = probeId; this.erzeuger = erzeuger; @@ -54,16 +50,16 @@ @Id @Column(name = "k_id", nullable = false, insertable = false, updatable = false) - @GeneratedValue(strategy=GenerationType.IDENTITY) - public Integer getkId() { - return this.kId; + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ID_STORE") + public int getkId() { + return kId; } - public void setkId(Integer kId) { + public void setkId(int kId) { this.kId = kId; } - @Column(name = "probe_id", nullable = false, insertable = false, updatable = false) + @Column(name = "probe_id", nullable = false, length = 20) public String getProbeId() { return this.probeId; }
--- a/src/main/java/de/intevation/lada/model/LKommentarPId.java Mon Jul 01 15:20:23 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -package de.intevation.lada.model; - -// Generated 21.05.2013 16:58:30 by Hibernate Tools 3.4.0.CR1 - -import javax.persistence.Column; -import javax.persistence.Embeddable; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.SequenceGenerator; - -/** - * LKommentarPId generated by hbm2java - */ -@Embeddable -public class LKommentarPId implements java.io.Serializable { - - private String probeId; - private int KId; - - public LKommentarPId() { - } - - public LKommentarPId(String probeId, int KId) { - this.probeId = probeId; - this.KId = KId; - } - - @Column(name = "probe_id", nullable = false, length = 20) - public String getProbeId() { - return this.probeId; - } - - public void setProbeId(String probeId) { - this.probeId = probeId; - } - - @Column(name = "k_id", nullable = false) - @GeneratedValue(strategy= GenerationType.AUTO, generator = "SEQ_Store") - @SequenceGenerator(name = "SEQ_Store", sequenceName="lkommentarp_sequence") - public int getKId() { - return this.KId; - } - - public void setKId(int KId) { - this.KId = KId; - } - - public boolean equals(Object other) { - if ((this == other)) - return true; - if ((other == null)) - return false; - if (!(other instanceof LKommentarPId)) - return false; - LKommentarPId castOther = (LKommentarPId) other; - - return ((this.getProbeId() == castOther.getProbeId()) || (this - .getProbeId() != null && castOther.getProbeId() != null && this - .getProbeId().equals(castOther.getProbeId()))) - && (this.getKId() == castOther.getKId()); - } - - public int hashCode() { - int result = 17; - - result = 37 * result - + (getProbeId() == null ? 0 : this.getProbeId().hashCode()); - result = 37 * result + this.getKId(); - return result; - } - -}