changeset 8605:b0e5a2ce0b09

(issue1750) Fix id handling with oracle On oracle the id is returned as BigDecimal. This could probably be done better with hibernate but checking the Object also works.
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 20 Mar 2015 18:42:00 +0100
parents 958342db7a15
children c985b27e3a8c
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/StaticSQFactory.java
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/StaticSQFactory.java	Fri Mar 20 17:31:06 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/StaticSQFactory.java	Fri Mar 20 18:42:00 2015 +0100
@@ -100,7 +100,7 @@
         StaticSQContainer retval = getSQRelations(river, measurementStation);
 
         /* And some others */
-        List<Integer> list = query.list();
+        List<Object> list = query.list();
         if (list == null || list.isEmpty()) {
             log.error("Did not even find one measurement station. Broken Query?");
             log.debug("River: " + river);
@@ -113,7 +113,14 @@
             return retval;
         }
 
-        for (Integer stationId: list) {
+        for (Object stationIdO: list) {
+            Integer stationId;
+            if (stationIdO instanceof BigDecimal) {
+                stationId = ((BigDecimal)stationIdO).intValue();
+            } else {
+                /* If it is something else entirely we die here. */
+                stationId = (Integer) stationIdO;
+            }
             log.debug("Collecting SQ Relations for: "+ stationId);
             if (stationId == measurementStation) {
                 /* Skip the same station */

http://dive4elements.wald.intevation.org