Package com.jk.data.vendors.mongo
Class JKMongoDataAccess
java.lang.Object
com.jk.data.vendors.mongo.JKMongoDataAccess
- All Implemented Interfaces:
JKNoSqlDataAccess
,JKObjectDataAccess
The Class JKMongoDataAccess.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> T
clone
(T model) Clone.void
closeTransaction
(boolean commit) Close transaction.<T> T
Delete.<T> T
delete
(T obj) Delete.<T> void
detach
(T model) Detach.<T> List<T>
executeQuery
(Class<T> clas, String queryString, Object... paramters) Execute query.<T> T
Find.<T> List<T>
findByFieldName
(Class<T> clas, String fieldName, Object value) Find by field name.<T> T
findOneByFieldName
(Class<T> clas, String fieldName, Object fieldValue) Find one by field name.protected <T> com.mongodb.client.MongoCollection<T>
getCollection
(Class<?> clas) Gets the collection.protected String
getDocumentName
(Class<?> clas) Gets the document name.<T> List<T>
Gets the list.<T> List<T>
Gets the list.<T> List<T>
getListAndCache
(Class<T> clas) Gets the list and cache.<T> T
insert
(T obj) Insert.<T> T
insertOrUpdate
(T object) Insert or update.void
setMaxResults
(int maxResults) Sets the max results.void
Start transaction.<T> T
Update.<T> T
update
(T obj) Update.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jk.data.dataaccess.orm.JKObjectDataAccess
executeSingleOutputQuery
-
Constructor Details
-
JKMongoDataAccess
public JKMongoDataAccess()
-
-
Method Details
-
getCollection
Gets the collection.- Type Parameters:
T
- the generic type- Parameters:
clas
- the clas- Returns:
- the collection
-
getDocumentName
Gets the document name.- Parameters:
clas
- the clas- Returns:
- the document name
-
insert
public <T> T insert(T obj) Insert.- Specified by:
insert
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
obj
- the obj- Returns:
- the t
-
getList
Gets the list.- Specified by:
getList
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
clas
- the clas- Returns:
- the list
-
findByFieldName
Find by field name.- Specified by:
findByFieldName
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
clas
- the clasfieldName
- the field namevalue
- the value- Returns:
- the list
-
getList
Gets the list.- Specified by:
getList
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
clas
- the clasfilter
- the filter- Returns:
- the list
-
find
Find.- Specified by:
find
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
clas
- the clasid
- the id- Returns:
- the t
-
delete
Delete.- Specified by:
delete
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
clas
- the clasid
- the id- Returns:
- the t
-
delete
public <T> T delete(T obj) Delete.- Specified by:
delete
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
obj
- the obj- Returns:
- the t
-
update
public <T> T update(T obj) Update.- Specified by:
update
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
obj
- the obj- Returns:
- the t
-
update
Update.- Type Parameters:
T
- the generic type- Parameters:
id
- the idobj
- the obj- Returns:
- the t
-
findOneByFieldName
Find one by field name.- Specified by:
findOneByFieldName
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
clas
- the clasfieldName
- the field namefieldValue
- the field value- Returns:
- the t
-
executeQuery
Execute query.- Specified by:
executeQuery
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
clas
- the clasqueryString
- the query stringparamters
- the paramters- Returns:
- the list
-
insertOrUpdate
public <T> T insertOrUpdate(T object) Insert or update.- Specified by:
insertOrUpdate
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
object
- the object- Returns:
- the t
-
setMaxResults
public void setMaxResults(int maxResults) Sets the max results.- Specified by:
setMaxResults
in interfaceJKObjectDataAccess
- Parameters:
maxResults
- the new max results
-
detach
public <T> void detach(T model) Detach.- Specified by:
detach
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
model
- the model
-
clone
public <T> T clone(T model) Clone.- Specified by:
clone
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
model
- the model- Returns:
- the t
-
startTransaction
public void startTransaction()Start transaction.- Specified by:
startTransaction
in interfaceJKObjectDataAccess
-
closeTransaction
public void closeTransaction(boolean commit) Close transaction.- Specified by:
closeTransaction
in interfaceJKObjectDataAccess
- Parameters:
commit
- the commit
-
getListAndCache
Gets the list and cache.- Specified by:
getListAndCache
in interfaceJKObjectDataAccess
- Type Parameters:
T
- the generic type- Parameters:
clas
- the clas- Returns:
- the list and cache
-