@Override public void create() throws EntityAlreadyExistsException { EntityRef<E, C, U> ref = getEntityRef(); try { while (true) { ref.create(configuration); try { ref.fetchEntity(null).close(); return; } catch (EntityNotFoundException e) { //continue; } } } catch (EntityNotProvidedException | EntityVersionMismatchException e) { LOGGER.error("Unable to create entity {} for id {}", entityType.getName(), entityIdentifier, e); throw new AssertionError(e); } catch (EntityConfigurationException e) { LOGGER.error("Unable to create entity - configuration exception", e); throw new AssertionError(e); } }
private static <T extends Entity> void fetchEntity(Connection connection, Class<T> aClass, String myCacheManager) throws EntityNotFoundException, ConnectionException { try { connection.getEntityRef(aClass, EhcacheEntityVersion.ENTITY_VERSION, myCacheManager).fetchEntity(null).close(); } catch (EntityNotProvidedException | EntityVersionMismatchException e) { throw new AssertionError(e); } }
@Override public void create() throws EntityAlreadyExistsException { EntityRef<E, C, U> ref = getEntityRef(); try { while (true) { ref.create(configuration); try { ref.fetchEntity(null).close(); return; } catch (EntityNotFoundException e) { //continue; } } } catch (EntityNotProvidedException | EntityVersionMismatchException e) { LOGGER.error("Unable to create entity {} for id {}", entityType.getName(), entityIdentifier, e); throw new AssertionError(e); } catch (EntityConfigurationException e) { LOGGER.error("Unable to create entity - configuration exception", e); throw new AssertionError(e); } }