Search in sources :

Example 1 with EntityResultSet

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);
}
Also used : EntityResultSet(org.thingsboard.server.dao.model.wrapper.EntityResultSet) Statement(com.datastax.driver.core.Statement) EntityResultSet(org.thingsboard.server.dao.model.wrapper.EntityResultSet) ResultSet(com.datastax.driver.core.ResultSet)

Aggregations

ResultSet (com.datastax.driver.core.ResultSet)1 Statement (com.datastax.driver.core.Statement)1 EntityResultSet (org.thingsboard.server.dao.model.wrapper.EntityResultSet)1