Class NosqlTemplate
java.lang.Object
com.oracle.nosql.spring.data.core.NosqlTemplateBase
com.oracle.nosql.spring.data.core.NosqlTemplate
- All Implemented Interfaces:
NosqlOperations,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
-
Field Summary
Fields inherited from class com.oracle.nosql.spring.data.core.NosqlTemplateBase
applicationContext, JSON_COLUMN, LOG, mappingNosqlConverter, nosqlClient, nosqlDbFactory, psCache -
Constructor Summary
ConstructorsConstructorDescriptionNosqlTemplate(NosqlDbFactory nosqlDbFactory, MappingNosqlConverter mappingNosqlConverter) -
Method Summary
Modifier and TypeMethodDescriptionlongcount(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 NosqlTemplatecreate(NosqlDbConfig nosqlDBConfig) static NosqlTemplatecreate(NosqlDbFactory nosqlDbFactory) booleancreateTableIfNotExists(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) voiddeleteAll(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.booleandropTableIfExists(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(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> Iterable<T>Returns a result of all the entities in the table.<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(NosqlEntityInformation<T, ID> entityInformation, ID id) Returns the entity for the given id in the given table.<T,ID> T Returns the entity for the given table.Returns the assigned mapping converter.oracle.nosql.driver.NoSQLHandle<T> NosqlEntityInformation<T,?> getNosqlEntityInformation(Class<T> domainClass) getTableName(Class<?> domainClass) Returns the tableName for the given entity class.<T,ID> T insert(NosqlEntityInformation<T, ID> entityInformation, T entity) If entity doesn't have autogen field objectToSave is wrote using put.<T> Tinsert(T entity) 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 objectsIterable<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 FieldValuevoidrunTableRequest(String statement) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) <T,ID> void update(NosqlEntityInformation<T, ID> entityInformation, T entity) Updates the entity into the given table.<T> voidupdate(T entity) Updates the entity into the table.Methods inherited from class com.oracle.nosql.spring.data.core.NosqlTemplateBase
doCheckExistingTable, doCreateTable, doDelete, doExecuteMapValueQuery, doGet, doGetTable, doPut, doRunQueryNosqlParams, doTableRequest, doUpdate, getCreateTableDDL
-
Constructor Details
-
NosqlTemplate
-
-
Method Details
-
create
- Throws:
ClassNotFoundException
-
create
- Throws:
ClassNotFoundException
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Overrides:
setApplicationContextin classNosqlTemplateBase- Throws:
org.springframework.beans.BeansException
-
getTableName
Description copied from interface:NosqlOperationsReturns the tableName for the given entity class.- Specified by:
getTableNamein interfaceNosqlOperations
-
createTableIfNotExists
Description copied from interface:NosqlOperationsCreates a table for the given entity type if it doesn't exist.- Specified by:
createTableIfNotExistsin interfaceNosqlOperations
-
insert
public <T> T insert(@NonNull T entity) Description copied from interface:NosqlOperationsInserts the entity into the table, if id generated is used the id field must be null or 0.- Specified by:
insertin interfaceNosqlOperations
-
insert
If entity doesn't have autogen field objectToSave is wrote using put. If entity has autogen field objectToSave should not have field set.- Specified by:
insertin interfaceNosqlOperations
-
update
public <T> void update(T entity) Description copied from interface:NosqlOperationsUpdates the entity into the table. Entity must contain a valid id value.- Specified by:
updatein interfaceNosqlOperations
-
update
Description copied from interface:NosqlOperationsUpdates the entity into the given table. Entity must contain a valid id value.- Specified by:
updatein interfaceNosqlOperations
-
deleteAll
Description copied from interface:NosqlOperationsDeletes all entries from the given table.- Specified by:
deleteAllin interfaceNosqlOperations
-
deleteAll
public <T,ID> void deleteAll(NosqlEntityInformation<T, ID> entityInformation, Iterable<? extends ID> ids) Description copied from interface:NosqlOperationsDeletes all the entries with the ids from the given table.- Specified by:
deleteAllin interfaceNosqlOperations
-
deleteInShard
public <T,ID> void deleteInShard(String tableName, Class<T> entityClass, Iterable<? extends ID> ids) Deletes ids from one shard. Note: All ids must be in the same shard otherwise it's an error. It usesNoSQLHandle.writeMultiple(WriteMultipleRequest). -
dropTableIfExists
Drops table and returns true if result indicates table state changed to DROPPED or DROPPING. UsesNosqlDbFactory.getTableReqTimeout()andNosqlDbFactory.getTableReqPollInterval()to check the result.- Specified by:
dropTableIfExistsin interfaceNosqlOperations
-
getConverter
Description copied from interface:NosqlOperationsReturns the assigned mapping converter.- Specified by:
getConverterin interfaceNosqlOperations
-
getNosqlEntityInformation
-
findById
Description copied from interface:NosqlOperationsReturns the entity for the given table.- Specified by:
findByIdin interfaceNosqlOperations
-
findById
Description copied from interface:NosqlOperationsReturns the entity for the given id in the given table.- Specified by:
findByIdin interfaceNosqlOperations
-
findAllById
public <T,ID> Iterable<T> findAllById(NosqlEntityInformation<T, ID> entityInformation, Iterable<ID> ids) Description copied from interface:NosqlOperationsReturns all the entities in the table for the given ids.- Specified by:
findAllByIdin interfaceNosqlOperations
-
deleteById
Description copied from interface:NosqlOperationsDeletes the entity with the id from the given table.- Specified by:
deleteByIdin interfaceNosqlOperations
-
findAll
Description copied from interface:NosqlOperationsReturns a result of all the entities in the table. Not recommended, unless table is known to contain a small amount of rows. Instead use the method with Pageable parameter.- Specified by:
findAllin interfaceNosqlOperations
-
findAll
Description copied from interface:NosqlOperationsReturns a result of all the entities in the given table. Not recommended, unless table is known to contain a small amount of rows. Instead use the method with Pageable parameter.- Specified by:
findAllin interfaceNosqlOperations
-
count
Description copied from interface:NosqlOperationsReturns a count of all the entries in the given table.- Specified by:
countin interfaceNosqlOperations
-
findAll
public <T> Iterable<T> findAll(NosqlEntityInformation<T, ?> entityInformation, org.springframework.data.domain.Sort sort) Description copied from interface:NosqlOperationsReturns all entities in the given table sorted accordingly.- Specified by:
findAllin interfaceNosqlOperations
-
findAll
public <T> org.springframework.data.domain.Page<T> findAll(NosqlEntityInformation<T, ?> entityInformation, org.springframework.data.domain.Pageable pageable) Description copied from interface:NosqlOperationsReturns all entities in the given table sorted accordingly grouped in pages.- Specified by:
findAllin interfaceNosqlOperations
-
runTableRequest
-
runQuery
public Iterable<oracle.nosql.driver.values.MapValue> runQuery(NosqlEntityInformation<?, ?> entityInformation, String query) -
runQueryJavaParams
public 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 -
runQueryNosqlParams
public 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 -
count
public <T> Iterable<oracle.nosql.driver.values.MapValue> count(NosqlEntityInformation<T, ?> entityInformation, NosqlQuery query) - Specified by:
countin interfaceNosqlOperations
-
delete
- Specified by:
deletein interfaceNosqlOperations
-
find
public <S,T> Iterable<T> find(NosqlEntityInformation<S, ?> entityInformation, Class<T> targetType, NosqlQuery query) Description copied from interface:NosqlOperationsExecutes a NosqlQuery (this can be a CriteriaQuery for queries derived from repository method names or a StringQuery for native queries).- Specified by:
findin interfaceNosqlOperations
-
getNosqlClient
public oracle.nosql.driver.NoSQLHandle getNosqlClient()
-