Hello! Can you please frame it as a small project on Github? I promise to take a look then.
Regards, -- Ilya Kasnacheev пн, 11 мар. 2019 г. в 15:55, austin solomon <[email protected]>: > Thanks Ilya, > I tried implementing your example in below manner but the overridden > loadCache() is never called. > > public class CacheJdbct1Store extends CacheStoreAdapter<Integer,t1> { > > /** Data source. */ > public static final DataSource DATA_SRC = > > > JdbcConnectionPool.create("jdbc:sqlserver://localhost:8067;databaseName=TestDB","**","**"); > > /** Spring JDBC template. */ > private JdbcTemplate jdbcTemplate; > > /** > * Constructor. > * > * @throws IgniteException If failed. > */ > public CacheJdbct1Store() throws IgniteException { > jdbcTemplate = new JdbcTemplate(DATA_SRC); > } > > /** {@inheritDoc} */ > @Override public t1 load(Integer key) { > System.out.println(">>> Store load [key=" + key + ']'); > > try { > return jdbcTemplate.queryForObject("select * from t1", new > RowMapper<t1>() { > public t1 mapRow(ResultSet rs, int rowNum) throws > SQLException { > return new t1(rs.getString(2), > > rs.getInt(3),rs.getLong(4),rs.getInt(5),rs.getTimestamp(6),rs.getTimestamp(7)); > } > }, key); > } > catch (EmptyResultDataAccessException ignored) { > return null; > } > } > > /** {@inheritDoc} */ > public void write(Cache.Entry<? extends Integer, ? extends t1> entry) { > //To Be Implemented > } > > /** {@inheritDoc} */ > @Override public void delete(Object key) { > System.out.println(">>> Store delete [key=" + key + ']'); > //To Be Implemented > } > > /** {@inheritDoc} */ > @Override public void loadCache(final IgniteBiInClosure<Integer, t1> > clo, Object... args) { > if (args == null || args.length == 0 || args[0] == null) > throw new CacheLoaderException("Expected entry count parameter > is not provided."); > > int entryCnt = (Integer)args[0]; > > final AtomicInteger cnt = new AtomicInteger(); > > jdbcTemplate.query("select * from t1", new RowCallbackHandler() { > @Override public void processRow(ResultSet rs) throws > SQLException { > t1 bic = new t1(rs.getString(1), > > rs.getInt(2),rs.getLong(3),rs.getInt(4),rs.getTimestamp(5),rs.getTimestamp(6)); > > clo.apply(rs.getInt(0), bic); > > cnt.incrementAndGet(); > } > }, entryCnt); > > System.out.println(">>> Loaded " + cnt + " values into cache."); > } > } > > > Main CLASS: > Ignite ignite = Ignition.start("JDBCLoadCluster-client.xml"); > IgniteCache<Integer, t1> cache = ignite.getOrCreateCache("t1"); > cache.loadCache(null); > System.out.println("Cache load complete"); > > Please correct me what I am missing in this to load delta data. > > Thanks, > Austin > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
