IgniteCache#loadCache should ignore writeThrough, in other words, records loaded via loadCache method should not be inserted to RDBMS.
The second option is to manually load the data using a cache/datastreamer instance obtained via IgniteCache#witkSkipStore() or IgniteDataStreamer#skipStore.
public class CacheStoreExample {
public static void main(String[] args) {
Ignite ignite = Ignition.start(
new IgniteConfiguration()
.setCacheConfiguration(new CacheConfiguration("cache")
.setWriteThrough(true)
.setWriteBehindEnabled(true)
.setCacheStoreFactory(new Factory<CacheStore>() {
@Override public CacheStore create() {
return new CacheStoreAdapter() {
@Override public void loadCache(IgniteBiInClosure clo, Object... args) {
System.out.println("Loading cache with single a single key/value:");
clo.apply(1,1);
}
@Override public Object load(Object key) throws CacheLoaderException {return null; }
@Override public void write(Cache.Entry entry) throws CacheWriterException {
System.out.println("Writing entry: "+entry);
}
@Override public void delete(Object key) throws CacheWriterException {}
};
}
})
));
IgniteCache<Object, Object> cache = ignite.cache("cache");
cache.loadCache((k, v) -> true);
System.out.println("The first record:"+cache.get(1));
System.out.println("Put operation skipping store");
cache.withSkipStore().put(2,2);
System.out.println("The second records:"+cache.get(2));
System.out.println("Put operation with write trough");
cache.put(3,3);
System.out.println("The third record:"+cache.get(3));
}
}