@Test void testGetStringIdLoaderThrowsException() { when(repository.findOneById("2")) .thenThrow(new MolgenisDataException("Table is missing for entity TestEntity")); assertThrows(UncheckedExecutionException.class, () -> l2Cache.get(repository, "2")); }
public Entity get(Repository<Entity> repository, Object id) { LoadingCache<Object, Optional<Map<String, Object>>> cache = getEntityCache(repository); EntityType entityType = repository.getEntityType(); return cache.getUnchecked(id).map(e -> entityHydration.hydrate(e, entityType)).orElse(null); }
L2Cache implements TransactionListener { public Entity get(Repository<Entity> repository, Object id) { LoadingCache<Object, Optional<Map<String, Object>>> cache = getEntityCache(repository); EntityType entityType = repository.getEntityType(); return cache.getUnchecked(id).map(e -> entityHydration.hydrate(e, entityType)).orElse(null); } }
L2Cache implements TransactionListener { public Entity get(Repository<Entity> repository, Object id) { LoadingCache<Object, Optional<Map<String, Object>>> cache = getEntityCache(repository); EntityType entityType = repository.getEntityType(); return cache.getUnchecked(id).map(e -> entityHydration.hydrate(e, entityType)).orElse(null); } L2Cache(
      TransactionManager transactionManager,
      EntityHydration entityHydration,
      TransactionInformation transactionInformation,
      MeterRegistry meterRegistry); }
L2Cache implements TransactionListener { public Entity get(Repository<Entity> repository, Object id) { LoadingCache<Object, Optional<Map<String, Object>>> cache = getEntityCache(repository); EntityType entityType = repository.getEntityType(); return cache.getUnchecked(id).map(e -> entityHydration.hydrate(e, entityType)).orElse(null); } L2Cache(
      TransactionManager transactionManager,
      EntityHydration entityHydration,
      TransactionInformation transactionInformation,
      MeterRegistry meterRegistry); @Override void afterCommitTransaction(String transactionId); Entity get(Repository<Entity> repository, Object id); Entity get(Repository<Entity> repository, Object id, Fetch fetch); List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids); List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids, Fetch fetch); @Scheduled(fixedRate = 60000) void logStatistics(); }
L2Cache implements TransactionListener { public Entity get(Repository<Entity> repository, Object id) { LoadingCache<Object, Optional<Map<String, Object>>> cache = getEntityCache(repository); EntityType entityType = repository.getEntityType(); return cache.getUnchecked(id).map(e -> entityHydration.hydrate(e, entityType)).orElse(null); } L2Cache(
      TransactionManager transactionManager,
      EntityHydration entityHydration,
      TransactionInformation transactionInformation,
      MeterRegistry meterRegistry); @Override void afterCommitTransaction(String transactionId); Entity get(Repository<Entity> repository, Object id); Entity get(Repository<Entity> repository, Object id, Fetch fetch); List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids); List<Entity> getBatch(Repository<Entity> repository, Iterable<Object> ids, Fetch fetch); @Scheduled(fixedRate = 60000) void logStatistics();  }