[ 
https://issues.apache.org/jira/browse/CAMEL-20010?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-20010:
--------------------------------
    Fix Version/s: 4.0.2
                   4.2.0

> Can't change table name in JdbcMessageIdRepository by adding suffix/prefix
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-20010
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20010
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sql
>    Affects Versions: 3.21.1, 4.0.1, 4.1.0
>         Environment: * Apache Camel 3.21.1
>  * Spring Boot 2.7
>  * PostgreSQL
>            Reporter: Bruno Mendola
>            Priority: Major
>             Fix For: 4.0.2, 4.2.0
>
>
> If I want to use JdbcMessageIdRepository and add the schema name as prefix to 
> the CAMEL_MESSAGEPROCESSED table name, I can do something like this:
> {code:java}
> idempotentRepository.setTableName("myschema.CAMEL_MESSAGEPROCESSED");
> {code}
> (the idempotentRepository is registered as bean in the CamelContext).
> But when using the idempotentRepository with an idempotentConsumer in a 
> route, I get the following error:
> {code:java}
> org.apache.camel.RuntimeCamelException: 
> org.springframework.jdbc.UncategorizedSQLException: StatementCallback; 
> uncategorized SQLException for SQL [SELECT 1 FROM 
> myschema.myschema.CAMEL_MESSAGEPROCESSED WHERE 1 = 0]; SQL state [0A000]; 
> error code [0]; ERROR: cross-database references are not implemented: 
> "myschema.myschema.camel_messageprocessed"   Position: 15; nested exception 
> is org.postgresql.util.PSQLException: ERROR: cross-database references are 
> not implemented: "myschema.myschema.camel_messageprocessed"   Position: 15
> {code}
> The query is generated with a double schema name prefix 
> ({*}myschema.myschema.{*}camel_messageprocessed).
> JdbcMessageIdRepository is designed to replace the CAMEL_MESSAGEPROCESSED 
> substring in the queries with the custom table name in the {{onInit()}} 
> function, but looks like this function is called multiple times and it keeps 
> replacing the substring that is present also in the custom table name.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to