return new H2Dialect();
/** {@inheritDoc} */ @Override public String mergeQuery(String fullTblName, Collection<String> keyCols, Collection<String> uniqCols) { Collection<String> cols = F.concat(false, keyCols, uniqCols); return String.format("MERGE INTO %s (%s) KEY (%s) VALUES(%s)", fullTblName, mkString(cols, ","), mkString(keyCols, ","), repeat("?", cols.size(), "", ", ", "")); } }
/** {@inheritDoc} */ @Override public String updateQuery(String tblName, Collection<String> keyCols, Iterable<String> valCols) { return super.updateQuery(tblName, keyCols, valCols) + " AND 1 = 0"; } });
store.setDialect(new H2Dialect() {
/** {@inheritDoc} */ @Override public String mergeQuery(String fullTblName, Collection<String> keyCols, Collection<String> uniqCols) { Collection<String> cols = F.concat(false, keyCols, uniqCols); return String.format("MERGE INTO %s (%s) KEY (%s) VALUES(%s)", fullTblName, mkString(cols, ","), mkString(keyCols, ","), repeat("?", cols.size(), "", ", ", "")); } }
/** */ public CacheJdbcPojoStoreFactory getStoreFactory() { CacheJdbcPojoStoreFactory storeFactory = new CacheJdbcPojoStoreFactory(); storeFactory.setParallelLoadCacheMinimumThreshold(100); storeFactory.setBatchSize(100); storeFactory.setMaximumPoolSize(4); storeFactory.setDataSourceFactory(getDataSourceFactory()); storeFactory.setDialect(new H2Dialect()); storeFactory.setTypes(getJdbcType()); return storeFactory; }
/** */ public CacheJdbcPojoStoreFactory getStoreFactoryWithHangWriteAll() { TestJdbcPojoStoreFactoryWithHangWriteAll storeFactory = new TestJdbcPojoStoreFactoryWithHangWriteAll(); storeFactory.setParallelLoadCacheMinimumThreshold(100); storeFactory.setBatchSize(100); storeFactory.setMaximumPoolSize(4); storeFactory.setDataSourceFactory(getDataSourceFactory()); storeFactory.setDialect(new H2Dialect()); storeFactory.setTypes(getJdbcType()); return storeFactory; }
/** * @return Cache configuration for test. * @throws Exception In case when failed to create cache configuration. */ protected CacheConfiguration cacheConfiguration() throws Exception { CacheConfiguration cc = defaultCacheConfiguration(); cc.setName(CACHE_NAME); cc.setCacheMode(PARTITIONED); cc.setAtomicityMode(transactional ? TRANSACTIONAL : ATOMIC); cc.setWriteBehindEnabled(false); cc.setStoreKeepBinary(storeKeepBinary()); CacheJdbcPojoStoreFactory<Object, Object> storeFactory = new CacheJdbcPojoStoreFactory<>(); storeFactory.setDialect(new H2Dialect()); storeFactory.setTypes(storeTypes()); storeFactory.setDataSourceFactory(new H2DataSourceFactory()); // H2 DataSource factory. storeFactory.setSqlEscapeAll(sqlEscapeAll()); storeFactory.setParallelLoadCacheMinimumThreshold(parallelLoadThreshold); cc.setCacheStoreFactory(storeFactory); cc.setReadThrough(true); cc.setWriteThrough(true); cc.setLoadPreviousValue(true); return cc; }
storeFactory.setDialect(new H2Dialect());
return new H2Dialect();