...
If a named parameter cannot be resolved, then an exception is thrown.
From Camel 2.14 onward you can use Simple expressions as parameters as shown:
Bloc de code |
sql:select * from table where id=:#${property.myId} order by name[?options]
|
Notice that the standard ?
symbol that denotes the parameters to an SQL query is substituted with the #
symbol, because the ?
symbol is used to specify options for the endpoint. The ?
symbol replacement can be configured on endpoint basis.
...
Bloc de code |
|
from("direct:projects")
.to("sql:select * from projects where license = :#lic and id > :#min order by id")
|
Using _expression_ parameters
Available as of Camel 2.14
In the given route below, we want to get all the project from the database. It uses the body of the exchange for defining the license and uses the value of a property as the second parameter.
Bloc de code |
|
from("direct:projects")
.setBody(constant("ASF"))
.setProperty("min", constant(123))
.to("sql:select * from projects where license = :#${body} and id > :#${property.min} order by id")
|
Using the JDBC based idempotent repository
...