/** * Saves the given iterable of entities to the database * * @param entities * the iterable of entities to be saved to the database * @return the iterable of updated entities with any id/key/rev saved in each entity */ @SuppressWarnings("deprecation") @Override public <S extends T> Iterable<S> saveAll(final Iterable<S> entities) { if (arangoOperations.getVersion().getVersion().compareTo("3.4.0") < 0) { arangoOperations.upsert(entities, UpsertStrategy.UPDATE); } else { final S first = StreamSupport.stream(entities.spliterator(), false).findFirst().get(); arangoOperations.repsert(entities, (Class<S>) first.getClass()); } return entities; }
/** * Saves the given iterable of entities to the database * * @param entities * the iterable of entities to be saved to the database * @return the iterable of updated entities with any id/key/rev saved in each entity */ @SuppressWarnings("deprecation") @Override public <S extends T> Iterable<S> saveAll(final Iterable<S> entities) { if (arangoOperations.getVersion().getVersion().compareTo("3.4.0") < 0) { arangoOperations.upsert(entities, UpsertStrategy.UPDATE); } else { final S first = StreamSupport.stream(entities.spliterator(), false).findFirst().get(); arangoOperations.repsert(entities, (Class<S>) first.getClass()); } return entities; }
/** * Request the version of ArangoDB. * * @return the Version number * @throws ArangoDBGraphException if user has no access to the db */ public String getVersion() throws ArangoDBGraphException { try { return db.getVersion().getVersion(); } catch (ArangoDBException ex) { throw ArangoDBExceptions.getArangoDBException(ex); } }
/** * Saves the passed entity to the database using upsert from the template * * @param entity * the entity to be saved to the database * @return the updated entity with any id/key/rev saved */ @SuppressWarnings("deprecation") @Override public <S extends T> S save(final S entity) { if (arangoOperations.getVersion().getVersion().compareTo("3.4.0") < 0) { arangoOperations.upsert(entity, UpsertStrategy.REPLACE); } else { arangoOperations.repsert(entity); } return entity; }
/** * Saves the passed entity to the database using upsert from the template * * @param entity * the entity to be saved to the database * @return the updated entity with any id/key/rev saved */ @SuppressWarnings("deprecation") @Override public <S extends T> S save(final S entity) { if (arangoOperations.getVersion().getVersion().compareTo("3.4.0") < 0) { arangoOperations.upsert(entity, UpsertStrategy.REPLACE); } else { arangoOperations.repsert(entity); } return entity; }