@Override public final void saveOrUpdateAll(final Collection<ITraining> trainings) { final List<ITraining> cachedTrainings = new ArrayList<>(); for (final ITraining training : trainings) { trainingDao.saveOrUpdate(training); cachedTrainings.add(training); } if (!cachedTrainings.isEmpty()) { cache.addAll(cachedTrainings); } }
@Override public final int saveOrUpdate(final ITraining training) { final int id = trainingDao.saveOrUpdate(training); cache.addAll(Arrays.asList(training)); return id; }