changeset 108:03df43fdd359

Added repository for LOrt and changed member 'ort' to 'ortId' in LOrt.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 12 Jun 2013 13:13:03 +0200 (2013-06-12)
parents 5abec5413d65
children a2427e766398
files src/main/java/de/intevation/lada/data/LOrtRepository.java src/main/java/de/intevation/lada/model/LOrt.java
diffstat 2 files changed, 39 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/data/LOrtRepository.java	Wed Jun 12 13:13:03 2013 +0200
@@ -0,0 +1,30 @@
+package de.intevation.lada.data;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.criteria.CriteriaQuery;
+
+import de.intevation.lada.model.LOrt;
+
+
+public class LOrtRepository
+extends Repository
+{
+    /**
+     * The entitymanager managing the data.
+     */
+    @Inject
+    private EntityManager em;
+
+    /**
+     * Filter LProbe object list by the given criteria.
+     *
+     * @param criteria
+     * @return List of LProbe objects.
+     */
+    public List<LOrt> filter(CriteriaQuery<LOrt> criteria) {
+        return em.createQuery(criteria).getResultList();
+    }
+}
--- a/src/main/java/de/intevation/lada/model/LOrt.java	Wed Jun 12 11:07:16 2013 +0200
+++ b/src/main/java/de/intevation/lada/model/LOrt.java	Wed Jun 12 13:13:03 2013 +0200
@@ -21,7 +21,7 @@
 public class LOrt implements java.io.Serializable {
 
 	private int POrtId;
-	private Ort ort;
+	private Long ortId;
 	private String probeId;
 	private String ortsTyp;
 	private String ortszusatztext;
@@ -30,16 +30,16 @@
 	public LOrt() {
 	}
 
-	public LOrt(int POrtId, Ort ort, String probeId) {
+	public LOrt(int POrtId, Long ortId, String probeId) {
 		this.POrtId = POrtId;
-		this.ort = ort;
+		this.ortId = ortId;
 		this.probeId = probeId;
 	}
 
-	public LOrt(int POrtId, Ort ort, String probeId, String ortsTyp,
+	public LOrt(int POrtId, Long ortId, String probeId, String ortsTyp,
 			String ortszusatztext, Date letzteAenderung) {
 		this.POrtId = POrtId;
-		this.ort = ort;
+		this.ortId = ortId;
 		this.probeId = probeId;
 		this.ortsTyp = ortsTyp;
 		this.ortszusatztext = ortszusatztext;
@@ -56,14 +56,13 @@
 		this.POrtId = POrtId;
 	}
 
-	@ManyToOne(fetch = FetchType.EAGER)
 	@JoinColumn(name = "ort_id", nullable = false)
-	public Ort getOrt() {
-		return this.ort;
+	public Long getOrt() {
+		return this.ortId;
 	}
 
-	public void setOrt(Ort ort) {
-		this.ort = ort;
+	public void setOrt(Long ortId) {
+		this.ortId = ortId;
 	}
 
 	@Column(name = "probe_id", nullable = false)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)