use of org.thingsboard.server.dao.model.wrapper.EntityResultSet in project thingsboard by thingsboard.
the class CassandraAbstractModelDao method saveWithResult.
protected EntityResultSet<E> saveWithResult(E entity) {
log.debug("Save entity {}", entity);
if (entity.getId() == null) {
entity.setId(UUIDs.timeBased());
} else if (isDeleteOnSave()) {
removeById(entity.getId());
}
Statement saveStatement = getSaveQuery(entity);
saveStatement.setConsistencyLevel(cluster.getDefaultWriteConsistencyLevel());
ResultSet resultSet = executeWrite(saveStatement);
return new EntityResultSet<>(resultSet, entity);
}
Aggregations