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:22:42 UTC

[camel] branch camel-3.4.x 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 camel-3.4.x
in repository https://gitbox.apache.org/repos/asf/camel.git


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

commit 7ca330e1fb8f5f3cf5e253b27aefffb4741767ef
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 a6655fa..ab64f81 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;
@@ -331,7 +332,13 @@ public class JdbcAggregationRepository extends ServiceSupport implements Recover
                         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);