changeset 1925:01f2473e362d

Fixed flys/411 (Oracle max expressions for annotations query). flys-artifacts/trunk@3301 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 22 Nov 2011 14:00:55 +0000
parents 57b03b3ab15c
children fde3db5e68e8
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Nov 22 13:39:23 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Nov 22 14:00:55 2011 +0000
@@ -1,3 +1,10 @@
+2011-11-22  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	Fixed flys/411.
+
+	* src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java:
+	  Use different queries to avoid costy joins.
+
 2011-11-22  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java	Tue Nov 22 13:39:23 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java	Tue Nov 22 14:00:55 2011 +0000
@@ -30,14 +30,11 @@
     public static List<Annotation> getPointAnnotations(String river) {
         Session session = SessionHolder.HOLDER.get();
 
-        Query rangesQuery = session.createQuery(
-            "from Range where river.name=:name and b = null");
-        rangesQuery.setParameter("name", river);
-        List<Range> ranges = rangesQuery.list();
-
         Query query = session.createQuery(
-            "from Annotation where range in (:ranges) order by range.a");
-        query.setParameterList("ranges", ranges);
+            "from Annotation as an " +
+            "where an.range.b = null and an.range.river.name=:name " +
+            "order by range.a");
+        query.setParameter("name", river);
         return query.list();
     }
 

http://dive4elements.wald.intevation.org