You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/09/03 04:21:50 UTC

[camel] branch master updated: CAMEL-15489 camel-sql - Persistence Aggregator not compatible with Oracle-Java Data Type (#4154)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 2e32174  CAMEL-15489 camel-sql - Persistence Aggregator not compatible with Oracle-Java Data Type (#4154)
2e32174 is described below

commit 2e32174152f26e5a8dfbc25b8311e819e8422d09
Author: Chandrakant Hardahe <ch...@gmail.com>
AuthorDate: Thu Sep 3 09:51:15 2020 +0530

    CAMEL-15489 camel-sql - Persistence Aggregator not compatible with Oracle-Java Data Type (#4154)
    
    Co-authored-by: Chandrakant Hardahe <ch...@chardahe.pnq.csb>
---
 .../processor/aggregate/jdbc/JdbcAggregationRepository.java      | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
index f8f7c3d..369ec30 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
@@ -17,6 +17,7 @@
 package org.apache.camel.processor.aggregate.jdbc;
 
 import java.io.IOException;
+import java.math.BigDecimal;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -342,7 +343,13 @@ public class JdbcAggregationRepository extends ServiceSupport
                             new Object[] { key }, new int[] { Types.VARCHAR });
 
                     byte[] marshalledExchange = (byte[]) columns.get(EXCHANGE);
-                    long version = (long) columns.get(VERSION);
+                    long version;
+                    Object versionObj = columns.get(VERSION);
+                    if (versionObj instanceof BigDecimal) {
+                        version = ((BigDecimal) versionObj).longValue();
+                    } else {
+                        version = (long) versionObj;
+                    }
 
                     Exchange result = codec.unmarshallExchange(camelContext, marshalledExchange);
                     result.setProperty(VERSION_PROPERTY, version);