Guest User

Untitled

a guest
Aug 1st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. Creation of Pipelined SQL/NOSQL Queries in Java
  2. Query query1 = "select customer.id from customer where customer.name = 'ABC'";
  3. Query query2 = "select account.id from account where account.custid in {$1}";
  4. // $1 will be the input of second query
  5. from(query1).inputto(query2).printOutput();
  6.  
  7. from("direct:start")
  8. .setBody(constant("select customer.id as ID from customer where customer.name = 'ABC'"))
  9. .to("jdbc:myDataSource")
  10.  
  11. //now, use simple/ognl to extract the first result and the 'ID' from the Map in the body
  12. .setBody(simple("select account.id from account where account.custid in ${body[0][ID]}"))
  13. .to("jdbc:myDataSource")
  14.  
  15. .log("ACCOUNT IDS = ${body}");
Add Comment
Please, Sign In to add comment