public class NosqlTemplate extends NosqlTemplateBase implements NosqlOperations, org.springframework.context.ApplicationContextAware
JSON_COLUMN, LOG, mappingNosqlConverter, nosqlClient, nosqlDbFactory, psCache
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.
|
doCreateTableIfNotExists, doDelete, doExecuteMapValueQuery, doGet, doPut, doRunQueryNosqlParams, doTableRequest, doUpdate
public NosqlTemplate(NosqlDbFactory nosqlDbFactory, MappingNosqlConverter mappingNosqlConverter)
public static NosqlTemplate create(NosqlDbConfig nosqlDBConfig) throws ClassNotFoundException
ClassNotFoundException
public static NosqlTemplate create(NosqlDbFactory nosqlDbFactory) throws ClassNotFoundException
ClassNotFoundException
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public String getTableName(Class<?> domainClass)
NosqlOperations
getTableName
in interface NosqlOperations
public boolean createTableIfNotExists(NosqlEntityInformation<?,?> entityInformation)
NosqlOperations
createTableIfNotExists
in interface NosqlOperations
public <T> T insert(@NonNull T objectToSave)
NosqlOperations
insert
in interface NosqlOperations
public <T,ID> T insert(NosqlEntityInformation<T,ID> entityInformation, @NonNull T objectToSave)
insert
in interface NosqlOperations
public <T> void update(T objectToSave)
NosqlOperations
update
in interface NosqlOperations
public <T,ID> void update(NosqlEntityInformation<T,ID> entityInformation, T objectToSave)
NosqlOperations
update
in interface NosqlOperations
public void deleteAll(NosqlEntityInformation<?,?> entityInformation)
NosqlOperations
deleteAll
in interface NosqlOperations
public <T,ID> void deleteAll(NosqlEntityInformation<T,ID> entityInformation, Iterable<? extends ID> ids)
NosqlOperations
deleteAll
in interface NosqlOperations
public <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 NosqlOperations
public MappingNosqlConverter getConverter()
NosqlOperations
getConverter
in interface NosqlOperations
public <T> NosqlEntityInformation<T,?> getNosqlEntityInformation(Class<T> domainClass)
public <T,ID> T findById(ID id, Class<T> javaType)
NosqlOperations
findById
in interface NosqlOperations
public <T,ID> T findById(NosqlEntityInformation<T,ID> entityInformation, ID id)
NosqlOperations
findById
in interface NosqlOperations
public <T,ID> Iterable<T> findAllById(NosqlEntityInformation<T,ID> entityInformation, Iterable<ID> ids)
NosqlOperations
findAllById
in interface NosqlOperations
public <T,ID> void deleteById(NosqlEntityInformation<T,ID> entityInformation, ID id)
NosqlOperations
deleteById
in interface NosqlOperations
public <T> Iterable<T> findAll(Class<T> entityClass)
NosqlOperations
findAll
in interface NosqlOperations
public <T> Iterable<T> findAll(NosqlEntityInformation<T,?> entityInformation)
NosqlOperations
findAll
in interface NosqlOperations
public long count(NosqlEntityInformation<?,?> entityInformation)
NosqlOperations
count
in interface NosqlOperations
public <T> Iterable<T> findAll(NosqlEntityInformation<T,?> entityInformation, org.springframework.data.domain.Sort sort)
NosqlOperations
findAll
in interface NosqlOperations
public <T> org.springframework.data.domain.Page<T> findAll(NosqlEntityInformation<T,?> entityInformation, org.springframework.data.domain.Pageable pageable)
NosqlOperations
findAll
in interface NosqlOperations
public 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 NosqlOperations
public <T,ID> Iterable<T> delete(NosqlEntityInformation<T,ID> entityInformation, NosqlQuery query)
delete
in interface NosqlOperations
public <S,T> Iterable<T> find(NosqlEntityInformation<S,?> entityInformation, Class<T> targetType, NosqlQuery query)
NosqlOperations
find
in interface NosqlOperations
Copyright © 2022 Oracle Corporation. All rights reserved.