use of com.datastax.driver.core.BoundStatement in project cassandra-driver-mapping by valchkou.
the class MappingSession method updateValues.
/**
* Update values with options.
*
* @param id Primary Key
* @param class Entity.class
* @param propertyNames Array of properties to update
* @param value array of values to update
*/
public void updateValues(Object id, Class<?> clazz, String[] propertyNames, Object[] values, WriteOptions options) {
maybeSync(clazz);
BoundStatement bs = MappingBuilder.prepareUpdateValues(id, clazz, propertyNames, values, options, keyspace, session);
execute(bs);
}
use of com.datastax.driver.core.BoundStatement in project cassandra-driver-mapping by valchkou.
the class MappingSession method get.
/**
* Get Entity by Id(Primary Key)
*
* @param class Entity.class
* @param id primary key
* @param options ReadOptions
* @return Entity instance or null
*/
public <T> T get(Class<T> clazz, Object id, ReadOptions options) {
maybeSync(clazz);
BoundStatement bs = MappingBuilder.prepareSelect(clazz, id, options, keyspace, session);
if (bs != null) {
ResultSet rs = session.execute(bs);
List<T> all = getFromResultSet(clazz, rs);
if (all.size() > 0) {
return all.get(0);
}
}
return null;
}
use of com.datastax.driver.core.BoundStatement in project cassandra-driver-mapping by valchkou.
the class MappingSession method deleteValueAsync.
/**
* Asynchronously Delete value for an individual property
*
* @param id Primary Key
* @param class Entity.class
* @param propertyName Entity property
* @return ResultSetFuture.
*/
public ResultSetFuture deleteValueAsync(Object id, Class<?> clazz, String propertyName) {
maybeSync(clazz);
BoundStatement bs = MappingBuilder.prepareDelete(id, clazz, propertyName, keyspace, session);
return executeAsync(bs);
}
use of com.datastax.driver.core.BoundStatement in project cassandra-driver-mapping by valchkou.
the class MappingSession method updateValue.
/**
* Replace existing value with a new one.
*
* @param id Primary Key
* @param class Entity.class
* @param propertyName Entity property
* @param value new value
* @param options WriteOptions
*/
public void updateValue(Object id, Class<?> clazz, String propertyName, Object value, WriteOptions options) {
maybeSync(clazz);
BoundStatement bs = MappingBuilder.prepareUpdateValue(id, clazz, propertyName, value, options, keyspace, session);
execute(bs);
}
use of com.datastax.driver.core.BoundStatement in project cassandra-driver-mapping by valchkou.
the class MappingSession method deleteValue.
/**
* Delete value for an individual property
*
* @param id Primary Key
* @param class Entity.class
* @param propertyName Entity property
*/
public void deleteValue(Object id, Class<?> clazz, String propertyName) {
maybeSync(clazz);
BoundStatement bs = MappingBuilder.prepareDelete(id, clazz, propertyName, keyspace, session);
execute(bs);
}
Aggregations