Hi,

here is what I'm trying to do, but I'm not sure if I'm on the right track
or not.

I have a inbound file that I want to process, and use it to either create or
update existing rows in a table. I know I can do this using camel-jdbc, but
I wanted to see if it can be done with jpa

I know to use jpa with namedparameters I have to use it as a consumer.

and I need to use jpa mid-route as a consumer, and namedparamters can only
be
set using registry.

so I was thinking of flow like this

from("direct:fileprocess")
  .//bindy to process file
  .process(new SetQueryIdProcessor) // to find the id in the current line
of the file, and set it in registry
  .pollEnrich("jpa:" + Entity.class.getName() +
"?consumeDelete=false&consumer.namedQuery=findById&
   consumer.parameters=#params")  // to see if the record already exist

and then based on that, either update existing record, or create new one.
Am I on the right track? Is this doable
or is camel-jdbc the only way?

Thanks




-- 
Omnem crede diem tibi diluxisse supremum.

Reply via email to