182.14. 使用带有原生查询的制作者

要检索所选实体或执行批量更新/删除,您可以使用 nativeQuery URI 查询选项。您只需要定义原生查询选项:

from("direct:nativeQuery")
.to("jpa://org.apache.camel.examples.MultiSteps?resultClass=org.apache.camel.examples.MultiSteps&nativeQuery=select * from MultiSteps where step = 1");

如果您在没有指定 resultClass 的情况下使用原生查询选项,您将收到消息正文中的对象数组。