[PATCH] (issue1750) Fix id handling with oracle
Wald Commits
scm-commit at wald.intevation.org
Fri Mar 20 18:42:10 CET 2015
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1426873320 -3600
# Node ID b0e5a2ce0b09341858554c58a20be89ba721a12f
# Parent 958342db7a157fe66c3aa48e03800e7ddbf8dc46
(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.
diff -r 958342db7a15 -r b0e5a2ce0b09 artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/StaticSQFactory.java
--- 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 */
More information about the Dive4Elements-commits
mailing list