You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2014/11/02 09:31:34 UTC

[jira] [Resolved] (CAMEL-7983) Using named query parameters doesn't work

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

Claus Ibsen resolved CAMEL-7983.
--------------------------------
       Resolution: Cannot Reproduce
    Fix Version/s: 2.15.0
         Assignee: Claus Ibsen

Works fine. I cannot reproduce the issue, I get an error if I set an invalid named parameter, such as 'foo'

{code}
[mel-1) thread #1 - timer://foo] TimerConsumer                  WARN  Error processing exchange. Exchange[Message: {amount=3, id=0, description=ActiveMQ in Action, item=222}]. Caused by: [org.apache.camel.RuntimeExchangeException - Cannot find key [foo] in message body or headers to use when setting named parameter in query [insert into orders (id, item, amount, description, processed) values (:?id, :?foo, :?amount, :?description, false)] on the exchange: Exchange[Message: {amount=3, id=0, description=ActiveMQ in Action, item=222}]]
{code}

> Using named query parameters doesn't work
> -----------------------------------------
>
>                 Key: CAMEL-7983
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7983
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sql
>    Affects Versions: 2.14.0
>         Environment: Windows7, ActiveMq 5.10, Camel 2.14, MySQL Server 5.6
>            Reporter: Josef Awad
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.15.0
>
>
> Reference: http://camel.465427.n5.nabble.com/Using-named-query-parameters-td5758002.html
> Excerpt:
> Under http://camel.apache.org/sql-example.html  at the very bottom it says:
> Notice in the SQL queries below we use named parameters which must start with prefix ':#' and then the name, eg :#amount. Then Camel will bind that parameter with the given name, from the
> message body (if its a java.util.Map) or from a message header with the name. If none parameter could be found, Camel throws an exception.
> If I set a wrong parameter in the sql.properties I don't get any exception:
> sql.insertPosition=insert into mydb.test (col1) values (':#DoesNotExist') 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)