use of net.ravendb.client.exceptions.RavenException in project jnosql-diana-driver by eclipse.
the class RavenDBDocumentCollectionManager method update.
@Override
public DocumentEntity update(DocumentEntity entity) {
Objects.requireNonNull(entity, "entity is required");
try (IDocumentSession session = store.openSession()) {
Document id = entity.find(EntityConverter.ID_FIELD).orElseThrow(() -> new RavenException("Id is required to Raven Update operation"));
HashMap<String, Object> map = session.load(HashMap.class, id.get(String.class));
map.putAll(EntityConverter.getMap(entity));
session.saveChanges();
}
return entity;
}
Aggregations