Mercurial > lada > lada-server
changeset 57:d57f2aba50e0
Load 'LKommentarP' objects to 'LProbeDetails'.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 27 May 2013 15:24:48 +0200 |
parents | 9f3e902ce778 |
children | c85c64039b80 |
files | src/main/java/de/intevation/lada/data/LProbeRepository.java src/main/java/de/intevation/lada/model/LProbeDetails.java |
diffstat | 2 files changed, 26 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/data/LProbeRepository.java Mon May 27 15:23:41 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LProbeRepository.java Mon May 27 15:24:48 2013 +0200 @@ -12,6 +12,7 @@ import javax.persistence.criteria.Root; import de.intevation.lada.manage.LProbeManager; +import de.intevation.lada.model.LKommentarP; import de.intevation.lada.model.LOrt; import de.intevation.lada.model.LProbe; import de.intevation.lada.model.LProbeDetails; @@ -90,11 +91,19 @@ CriteriaBuilder cbLorts = em.getCriteriaBuilder(); CriteriaQuery<LOrt> criteriaLorts = cbLorts.createQuery(LOrt.class); - Root<LOrt> member = criteriaLorts.from(LOrt.class); - criteriaLorts.where(cbLorts.equal(member.get("probeId"), probe.getProbeId())); + Root<LOrt> lo = criteriaLorts.from(LOrt.class); + criteriaLorts.where(cbLorts.equal(lo.get("probeId"), probe.getProbeId())); List<LOrt> lorts = em.createQuery(criteriaLorts).getResultList(); details.setLorts(lorts); + CriteriaBuilder cbLKomm = em.getCriteriaBuilder(); + CriteriaQuery<LKommentarP> criteriaLKomm = + cbLKomm.createQuery(LKommentarP.class); + Root<LKommentarP> lk = criteriaLKomm.from(LKommentarP.class); + criteriaLorts.where(cbLorts.equal(lk.get("probeId"), probe.getProbeId())); + List<LKommentarP> lkomm = em.createQuery(criteriaLKomm).getResultList(); + details.setLkommentar(lkomm); + return details; } }
--- a/src/main/java/de/intevation/lada/model/LProbeDetails.java Mon May 27 15:23:41 2013 +0200 +++ b/src/main/java/de/intevation/lada/model/LProbeDetails.java Mon May 27 15:24:48 2013 +0200 @@ -9,13 +9,19 @@ private LProbe lprobe; private List<LOrt> lorts; + private List<LKommentarP> lkommentar; public LProbeDetails() { } - public LProbeDetails(LProbe lprobe, List<LOrt> lorts) { + public LProbeDetails( + LProbe lprobe, + List<LOrt> lorts, + List<LKommentarP> lkommentar + ) { this.lprobe = lprobe; this.lorts = lorts; + this.setLkommentar(lkommentar); } public LProbe getLprobe() { @@ -33,4 +39,12 @@ public void setLorts(List<LOrt> lorts) { this.lorts = lorts; } + + public List<LKommentarP> getLkommentar() { + return lkommentar; + } + + public void setLkommentar(List<LKommentarP> lkommentar) { + this.lkommentar = lkommentar; + } }