Search code examples
apache-camelquarkus

Why cant i add into toD a jpa with insert req


i have a route camel 4.0.0 with toD(query_jpa) but when running a field have XML string, with pre:timestamp2024-07-13T11:06:25+02:00</pre:timestamp>, the '+' desaspear on database.... and replacing by SPACE caracter. OK i know than toD use the URI HTTP , but i want keep all xml to insert on column database.

i have try into query a RAW(${header.xmlresponse})

INSERT INTO xxxx SET x,y,z values (x,y,RAW(${header.xmlResponse})

but the same thing... a lose the '+' caracter in db...

how can insert xml without lose something.

Thanks you.


Solution

  • Assuming you have a route like this:

    ...
    .toD("sql:INSERT INTO xxxx SET x,y,z values (x,y,RAW(${header.xmlResponse})")
    ...
    

    you can try to use an external sql file like:

    resources/sql/insert.sql

    INSERT INTO xxxx SET x,y,z values (x,y, :#xmlResponse)
    

    and then use it like this in your route:

    ...
    .toD("sql:classpath:sql/insert.sql")
    ...
    

    By using an external file instead of the uri notation, every character should be preserved.