public class Datastore extends Object
Provides basic crud operations, like a Mapper
without requiring an instance per each entity class.
Modifier and Type | Method and Description |
---|---|
void |
delete(Class<?> entityClass, Object id, com.datastax.driver.mapping.Mapper.Option... options)
Delete an entity by ID.
|
void |
delete(Object entity, com.datastax.driver.mapping.Mapper.Option... options)
Delete an entity.
|
com.google.common.util.concurrent.ListenableFuture<Void> |
deleteAsync(Class<?> entityClass, Object id, com.datastax.driver.mapping.Mapper.Option... options)
Delete an entity by ID.
|
com.google.common.util.concurrent.ListenableFuture<Void> |
deleteAsync(Object entity, com.datastax.driver.mapping.Mapper.Option... options)
Delete an entity.
|
<T> T |
get(Class<T> entityClass, Object id)
Fetch an entity based on its primary key.
|
<T> com.google.common.util.concurrent.ListenableFuture<T> |
getAsync(Class<T> entityClass, Object id)
Fetch an entity based on its primary key.
|
<T> com.datastax.driver.mapping.Result<T> |
query(Class<T> entityClass, com.datastax.driver.core.Statement statement)
Execute a query and map result to entityClass.
|
<T> com.datastax.driver.mapping.Result<T> |
query(Class<T> entityClass, String statement, Map<String,Object> values)
Execute a query and map result to entityClass.
|
<T> com.datastax.driver.mapping.Result<T> |
query(Class<T> entityClass, String statement, Object... values)
Execute a query and map result to entityClass.
|
<T> com.google.common.util.concurrent.ListenableFuture<com.datastax.driver.mapping.Result<T>> |
queryAsync(Class<T> entityClass, com.datastax.driver.core.Statement statement)
Execute a query and map result to entityClass.
|
<T> com.google.common.util.concurrent.ListenableFuture<com.datastax.driver.mapping.Result<T>> |
queryAsync(Class<T> entityClass, String statement, Map<String,Object> values)
Execute a query and map result to entityClass.
|
<T> com.google.common.util.concurrent.ListenableFuture<com.datastax.driver.mapping.Result<T>> |
queryAsync(Class<T> entityClass, String statement, Object... values)
Execute a query and map result to entityClass.
|
<T> void |
save(T entity, com.datastax.driver.mapping.Mapper.Option... options)
Save an entity.
|
<T> com.google.common.util.concurrent.ListenableFuture<Void> |
saveAsync(T entity, com.datastax.driver.mapping.Mapper.Option... options)
Save an entity.
|
public <T> T get(Class<T> entityClass, Object id)
entityClass
- Entity class.
id
- Object id.
null
.
public <T> com.google.common.util.concurrent.ListenableFuture<T> getAsync(Class<T> entityClass, Object id)
entityClass
- Entity class.
id
- Object id.
null
public void delete(Class<?> entityClass, Object id, com.datastax.driver.mapping.Mapper.Option... options)
entityClass
- Entity class.
id
- entity ID.
options
- Options.
public com.google.common.util.concurrent.ListenableFuture<Void> deleteAsync(Class<?> entityClass, Object id, com.datastax.driver.mapping.Mapper.Option... options)
entityClass
- Entity class.
id
- Entity id.
options
- Options.
public void delete(Object entity, com.datastax.driver.mapping.Mapper.Option... options)
entity
- Entity to delete.
options
- Options.
public com.google.common.util.concurrent.ListenableFuture<Void> deleteAsync(Object entity, com.datastax.driver.mapping.Mapper.Option... options)
entity
- Entity to delete.
options
- Options.
public <T> void save(T entity, com.datastax.driver.mapping.Mapper.Option... options)
entity
- Entity to save.
options
- Options.
public <T> com.google.common.util.concurrent.ListenableFuture<Void> saveAsync(T entity, com.datastax.driver.mapping.Mapper.Option... options)
entity
- Entity to save.
options
- Options.
public <T> com.datastax.driver.mapping.Result<T> query(Class<T> entityClass, String statement, Map<String,Object> values)
entityClass
- Entity class.
statement
- Statement to execute.
values
- Statement parameters.
public <T> com.datastax.driver.mapping.Result<T> query(Class<T> entityClass, String statement, Object... values)
entityClass
- Entity class.
statement
- Statement to execute.
values
- Statement parameters.
public <T> com.datastax.driver.mapping.Result<T> query(Class<T> entityClass, com.datastax.driver.core.Statement statement)
entityClass
- Entity class.
statement
- Statement to execute.
public <T> com.google.common.util.concurrent.ListenableFuture<com.datastax.driver.mapping.Result<T>> queryAsync(Class<T> entityClass, String statement, Map<String,Object> values)
entityClass
- Entity class.
statement
- Statement to execute.
values
- Statement parameters.
public <T> com.google.common.util.concurrent.ListenableFuture<com.datastax.driver.mapping.Result<T>> queryAsync(Class<T> entityClass, String statement, Object... values)
entityClass
- Entity class.
statement
- Statement to execute.
values
- Statement parameters.
public <T> com.google.common.util.concurrent.ListenableFuture<com.datastax.driver.mapping.Result<T>> queryAsync(Class<T> entityClass, com.datastax.driver.core.Statement statement)
entityClass
- Entity class.
statement
- Statement to execute.
Copyright © 2019. All rights reserved.