DefaultJpaRepository extends CrudRepositorySupport { public void flush() { final DataStore dataStore = getDataStore(); if (dataStore instanceof QueueingDataStore) { log.info("Asking the data store to flush the underlying operation queue"); final QueueingDataStore store = (QueueingDataStore) dataStore; store.flush(); } }  void flush(); Iterable deleteInBatch(Iterable entities); Iterable deleteAllInBatch(); Object getOne(Object key); Object saveAndFlush(Object entity);  }
@Test public void testFlushing() { final DefaultJpaRepository repository = new DefaultJpaRepository(); repository.setKeyGenerator(new UUIDKeyGenerator()); repository.setRepositoryMetadata(repositoryMetadata); final SpyingDataStore<Object, Object> dataStore = new SpyingDataStore<>(null, new AtomicLong()); repository.setDataStore(dataStore); repository.flush(); assertThat(dataStore.getRequests(), hasSize(1)); assertThat(dataStore.getRequests().get(0).getOperation(), is(Operation.FLUSH)); }