November 2017
Beginner to intermediate
290 pages
7h 34m
English
The JDBC output for this example extends the base transactional JDBC output operator from the Apex library. This operator contains all the plumbing for JDBC connection and transaction handling, so that we can focus on what's required to update the counts:
public static class CountStoreOperator extends AbstractJdbcTransactionableOutputOperator<KeyValPair<String, Integer>> { public static final String SQL = "MERGE INTO words USING (VALUES ?, ?) I (word, wcount)" + " ON (words.word=I.word)" + " WHEN MATCHED THEN UPDATE SET words.wcount = words.wcount + I.wcount" + " WHEN NOT MATCHED THEN INSERT (word, wcount) VALUES (I.word, I.wcount)"; @Override protected String getUpdateCommand() { return SQL; } @Override ...Read now
Unlock full access