# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller@intevation.de>
# Date 1321970455 0
# Node ID 01f2473e362d755b3b184f79e0c9e86f4db1bf99
# Parent  57b03b3ab15cd0738b5e03b225fbab00cfaadb24
Fixed flys/411 (Oracle max expressions for annotations query).

flys-artifacts/trunk@3301 c6561f87-3c4e-4783-a992-168aeb5c3f6f

diff -r 57b03b3ab15c -r 01f2473e362d flys-artifacts/ChangeLog
--- 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:
diff -r 57b03b3ab15c -r 01f2473e362d flys-artifacts/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();
     }