Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/StaticSQFactory.java @ 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 | 9bb7f19cbb6f |
comparison
equal
deleted
inserted
replaced
8604:958342db7a15 | 8605:b0e5a2ce0b09 |
---|---|
98 .setParameter("ms_id", measurementStation); | 98 .setParameter("ms_id", measurementStation); |
99 /* Take the first container for the station requested. */ | 99 /* Take the first container for the station requested. */ |
100 StaticSQContainer retval = getSQRelations(river, measurementStation); | 100 StaticSQContainer retval = getSQRelations(river, measurementStation); |
101 | 101 |
102 /* And some others */ | 102 /* And some others */ |
103 List<Integer> list = query.list(); | 103 List<Object> list = query.list(); |
104 if (list == null || list.isEmpty()) { | 104 if (list == null || list.isEmpty()) { |
105 log.error("Did not even find one measurement station. Broken Query?"); | 105 log.error("Did not even find one measurement station. Broken Query?"); |
106 log.debug("River: " + river); | 106 log.debug("River: " + river); |
107 log.debug("Mesurement station id: " + measurementStation); | 107 log.debug("Mesurement station id: " + measurementStation); |
108 return retval; | 108 return retval; |
111 if (list.size() > 2) { | 111 if (list.size() > 2) { |
112 log.error("More then two measurement stations found at the same range. Bad Data!"); | 112 log.error("More then two measurement stations found at the same range. Bad Data!"); |
113 return retval; | 113 return retval; |
114 } | 114 } |
115 | 115 |
116 for (Integer stationId: list) { | 116 for (Object stationIdO: list) { |
117 Integer stationId; | |
118 if (stationIdO instanceof BigDecimal) { | |
119 stationId = ((BigDecimal)stationIdO).intValue(); | |
120 } else { | |
121 /* If it is something else entirely we die here. */ | |
122 stationId = (Integer) stationIdO; | |
123 } | |
117 log.debug("Collecting SQ Relations for: "+ stationId); | 124 log.debug("Collecting SQ Relations for: "+ stationId); |
118 if (stationId == measurementStation) { | 125 if (stationId == measurementStation) { |
119 /* Skip the same station */ | 126 /* Skip the same station */ |
120 continue; | 127 continue; |
121 } | 128 } |