public class NosqlTemplate extends Object implements NosqlOperations, org.springframework.context.ApplicationContextAware
| Modifier and Type | Field and Description |
|---|---|
static String |
JSON_COLUMN |
| Constructor and Description |
|---|
NosqlTemplate(NosqlDbFactory nosqlDbFactory,
MappingNosqlConverter mappingNosqlConverter) |
| Modifier and Type | Method and Description |
|---|---|
long |
count(NosqlEntityInformation<?,?> entityInformation)
Returns a count of all the entries in the given table.
|
<T> Iterable<oracle.nosql.driver.values.MapValue> |
count(NosqlEntityInformation<T,?> entityInformation,
NosqlQuery query) |
static NosqlTemplate |
create(NosqlDbConfig nosqlDBConfig) |
static NosqlTemplate |
create(NosqlDbFactory nosqlDbFactory) |
boolean |
createTableIfNotExists(NosqlEntityInformation<?,?> entityInformation)
Creates a table for the given entity type if it doesn't exist.
|
<T,ID> Iterable<T> |
delete(NosqlEntityInformation<T,ID> entityInformation,
NosqlQuery query) |
void |
deleteAll(NosqlEntityInformation<?,?> entityInformation)
Deletes all entries from the given table.
|
<T,ID> void |
deleteAll(NosqlEntityInformation<T,ID> entityInformation,
Iterable<? extends ID> ids)
Deletes all the entries with the ids from the given table.
|
<T,ID> void |
deleteById(NosqlEntityInformation<T,ID> entityInformation,
ID id)
Deletes the entity with the id from the given table.
|
<T,ID> void |
deleteInShard(String tableName,
Class<T> entityClass,
Iterable<? extends ID> ids)
Deletes ids from one shard.
|
boolean |
dropTableIfExists(String tableName)
Drops table and returns true if result indicates table state changed to
DROPPED or DROPPING.
|
<S,T> Iterable<T> |
find(NosqlEntityInformation<S,?> entityInformation,
Class<T> targetType,
NosqlQuery query)
Executes a NosqlQuery (this can be a CriteriaQuery for queries
derived from repository method names or a StringQuery for native
queries).
|
<T> Iterable<T> |
findAll(Class<T> entityClass)
Returns a result of all the entities in the table.
|
<T> Iterable<T> |
findAll(NosqlEntityInformation<T,?> entityInformation)
Returns a result of all the entities in the given table.
|
<T> org.springframework.data.domain.Page<T> |
findAll(NosqlEntityInformation<T,?> entityInformation,
org.springframework.data.domain.Pageable pageable)
Returns all entities in the given table sorted accordingly grouped in
pages.
|
<T> Iterable<T> |
findAll(NosqlEntityInformation<T,?> entityInformation,
org.springframework.data.domain.Sort sort)
Returns all entities in the given table sorted accordingly.
|
<T,ID> Iterable<T> |
findAllById(NosqlEntityInformation<T,ID> entityInformation,
Iterable<ID> ids)
Returns all the entities in the table for the given ids.
|
<T,ID> T |
findById(ID id,
Class<T> javaType)
Returns the entity for the given table.
|
<T,ID> T |
findById(NosqlEntityInformation<T,ID> entityInformation,
ID id)
Returns the entity for the given id in the given table.
|
MappingNosqlConverter |
getConverter()
Returns the assigned mapping converter.
|
<T> NosqlEntityInformation<T,?> |
getNosqlEntityInformation(Class<T> domainClass) |
String |
getTableName(Class<?> domainClass)
Returns the tableName for the given entity class.
|
<T,ID> T |
insert(NosqlEntityInformation<T,ID> entityInformation,
T objectToSave)
If entity doesn't have autogen field objectToSave is wrote using put.
|
<T> T |
insert(T objectToSave)
Inserts the entity into the table, if id generated is used the id
field must be null or 0.
|
Iterable<oracle.nosql.driver.values.MapValue> |
runQuery(NosqlEntityInformation<?,?> entityInformation,
String query) |
Iterable<oracle.nosql.driver.values.MapValue> |
runQueryJavaParams(NosqlEntityInformation<?,?> entityInformation,
String query,
Map<String,Object> javaParams)
javaParams is a Map of param_name to Java objects
|
Iterable<oracle.nosql.driver.values.MapValue> |
runQueryNosqlParams(NosqlEntityInformation<?,?> entityInformation,
String query,
Map<String,oracle.nosql.driver.values.FieldValue> nosqlParams)
nosqlParams is a Map of param_name to FieldValue
|
void |
runTableRequest(String statement) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
<T,ID> void |
update(NosqlEntityInformation<T,ID> entityInformation,
T objectToSave)
Updates the entity into the given table.
|
<T> void |
update(T objectToSave)
Updates the entity into the table.
|
public static final String JSON_COLUMN
public NosqlTemplate(NosqlDbFactory nosqlDbFactory, MappingNosqlConverter mappingNosqlConverter)
public static NosqlTemplate create(NosqlDbConfig nosqlDBConfig) throws ClassNotFoundException
ClassNotFoundExceptionpublic static NosqlTemplate create(NosqlDbFactory nosqlDbFactory) throws ClassNotFoundException
ClassNotFoundExceptionpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic String getTableName(Class<?> domainClass)
NosqlOperationsgetTableName in interface NosqlOperationspublic boolean createTableIfNotExists(NosqlEntityInformation<?,?> entityInformation)
NosqlOperationscreateTableIfNotExists in interface NosqlOperationspublic <T> T insert(@NonNull
T objectToSave)
NosqlOperationsinsert in interface NosqlOperationspublic <T,ID> T insert(NosqlEntityInformation<T,ID> entityInformation, @NonNull T objectToSave)
insert in interface NosqlOperationspublic <T> void update(T objectToSave)
NosqlOperationsupdate in interface NosqlOperationspublic <T,ID> void update(NosqlEntityInformation<T,ID> entityInformation, T objectToSave)
NosqlOperationsupdate in interface NosqlOperationspublic void deleteAll(NosqlEntityInformation<?,?> entityInformation)
NosqlOperationsdeleteAll in interface NosqlOperationspublic <T,ID> void deleteAll(NosqlEntityInformation<T,ID> entityInformation, Iterable<? extends ID> ids)
NosqlOperationsdeleteAll in interface NosqlOperationspublic <T,ID> void deleteInShard(String tableName, Class<T> entityClass, Iterable<? extends ID> ids)
NoSQLHandle.writeMultiple(WriteMultipleRequest).public boolean dropTableIfExists(String tableName)
NosqlDbFactory.getTableReqTimeout() and
NosqlDbFactory.getTableReqPollInterval() to check the result.dropTableIfExists in interface NosqlOperationspublic MappingNosqlConverter getConverter()
NosqlOperationsgetConverter in interface NosqlOperationspublic <T> NosqlEntityInformation<T,?> getNosqlEntityInformation(Class<T> domainClass)
public <T,ID> T findById(ID id,
Class<T> javaType)
NosqlOperationsfindById in interface NosqlOperationspublic <T,ID> T findById(NosqlEntityInformation<T,ID> entityInformation, ID id)
NosqlOperationsfindById in interface NosqlOperationspublic <T,ID> Iterable<T> findAllById(NosqlEntityInformation<T,ID> entityInformation, Iterable<ID> ids)
NosqlOperationsfindAllById in interface NosqlOperationspublic <T,ID> void deleteById(NosqlEntityInformation<T,ID> entityInformation, ID id)
NosqlOperationsdeleteById in interface NosqlOperationspublic <T> Iterable<T> findAll(Class<T> entityClass)
NosqlOperationsfindAll in interface NosqlOperationspublic <T> Iterable<T> findAll(NosqlEntityInformation<T,?> entityInformation)
NosqlOperationsfindAll in interface NosqlOperationspublic long count(NosqlEntityInformation<?,?> entityInformation)
NosqlOperationscount in interface NosqlOperationspublic <T> Iterable<T> findAll(NosqlEntityInformation<T,?> entityInformation, org.springframework.data.domain.Sort sort)
NosqlOperationsfindAll in interface NosqlOperationspublic <T> org.springframework.data.domain.Page<T> findAll(NosqlEntityInformation<T,?> entityInformation, org.springframework.data.domain.Pageable pageable)
NosqlOperationsfindAll in interface NosqlOperationspublic void runTableRequest(String statement)
public Iterable<oracle.nosql.driver.values.MapValue> runQuery(NosqlEntityInformation<?,?> entityInformation, String query)
public Iterable<oracle.nosql.driver.values.MapValue> runQueryJavaParams(NosqlEntityInformation<?,?> entityInformation, String query, Map<String,Object> javaParams)
public Iterable<oracle.nosql.driver.values.MapValue> runQueryNosqlParams(NosqlEntityInformation<?,?> entityInformation, String query, Map<String,oracle.nosql.driver.values.FieldValue> nosqlParams)
public <T> Iterable<oracle.nosql.driver.values.MapValue> count(NosqlEntityInformation<T,?> entityInformation, NosqlQuery query)
count in interface NosqlOperationspublic <T,ID> Iterable<T> delete(NosqlEntityInformation<T,ID> entityInformation, NosqlQuery query)
delete in interface NosqlOperationspublic <S,T> Iterable<T> find(NosqlEntityInformation<S,?> entityInformation, Class<T> targetType, NosqlQuery query)
NosqlOperationsfind in interface NosqlOperationsCopyright © 2021 Oracle Corporation. All rights reserved.