public class DefaultEntityManager<T,K> extends java.lang.Object implements EntityManager<T,K>
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultEntityManager.Builder<T,K> |
| Modifier and Type | Method and Description |
|---|---|
static <T,K> DefaultEntityManager.Builder<T,K> |
builder() |
void |
commit()
Commit the internal batch after multiple operations.
|
NativeQuery<T,K> |
createNativeQuery()
Execute a 'native' query using a simple API that adheres to cassandra's native
model of rows and columns.
|
void |
createStorage(java.util.Map<java.lang.String,java.lang.Object> options)
Create the underlying storage for this entity.
|
void |
delete(java.util.Collection<K> ids)
Delete a set of entities by their id
|
void |
delete(K id)
delete the whole row by id
|
void |
deleteStorage()
Delete the underlying storage for this entity.
|
java.util.List<T> |
find(java.lang.String cql)
Execute a CQL query and return the found entites
|
java.util.List<T> |
get(java.util.Collection<K> ids) |
T |
get(K id)
fetch whole row and construct entity object mapping from columns
|
java.util.List<T> |
getAll() |
void |
put(java.util.Collection<T> entities)
Store a set of entities.
|
void |
put(T entity)
write entity to cassandra with mapped rowId and columns
|
void |
remove(java.util.Collection<T> entities)
Delete a set of entities
|
void |
remove(T entity)
remove an entire entity
|
void |
truncate()
Truncate all data in the underlying
|
void |
visitAll(com.google.common.base.Function<T,java.lang.Boolean> callback)
Visit all entities.
|
public static <T,K> DefaultEntityManager.Builder<T,K> builder()
public void put(T entity) throws javax.persistence.PersistenceException
EntityManagerput in interface EntityManager<T,K>entity - entity objectjavax.persistence.PersistenceExceptionpublic T get(K id) throws javax.persistence.PersistenceException
EntityManagerget in interface EntityManager<T,K>id - row keyjavax.persistence.PersistenceExceptionpublic void delete(K id) throws javax.persistence.PersistenceException
EntityManagerdelete in interface EntityManager<T,K>id - row keyjavax.persistence.PersistenceExceptionpublic void remove(T entity) throws javax.persistence.PersistenceException
EntityManagerremove in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic java.util.List<T> getAll() throws javax.persistence.PersistenceException
getAll in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic java.util.List<T> get(java.util.Collection<K> ids) throws javax.persistence.PersistenceException
get in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic void delete(java.util.Collection<K> ids) throws javax.persistence.PersistenceException
EntityManagerdelete in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic void remove(java.util.Collection<T> entities) throws javax.persistence.PersistenceException
EntityManagerremove in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic void put(java.util.Collection<T> entities) throws javax.persistence.PersistenceException
EntityManagerput in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic void visitAll(com.google.common.base.Function<T,java.lang.Boolean> callback) throws javax.persistence.PersistenceException
EntityManagervisitAll in interface EntityManager<T,K>callback - Callback when an entity is read. Note that the callback
may be called from multiple threads.javax.persistence.PersistenceExceptionpublic java.util.List<T> find(java.lang.String cql) throws javax.persistence.PersistenceException
EntityManagerfind in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic void createStorage(java.util.Map<java.lang.String,java.lang.Object> options)
throws javax.persistence.PersistenceException
EntityManagercreateStorage in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic void deleteStorage()
throws javax.persistence.PersistenceException
EntityManagerdeleteStorage in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic void truncate()
throws javax.persistence.PersistenceException
EntityManagertruncate in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic void commit()
throws javax.persistence.PersistenceException
EntityManagercommit in interface EntityManager<T,K>javax.persistence.PersistenceExceptionpublic NativeQuery<T,K> createNativeQuery()
EntityManagercreateNativeQuery in interface EntityManager<T,K>