Package com.jk.data.dataaccess.core
Interface JKDataAccessService
- All Known Implementing Classes:
H2DataAccess
,JKDataAccessImpl
,JKOracleDataAccess
,MysqlDataAccess
public interface JKDataAccessService
The Interface JKDataAccessService.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Begin transaction.void
closeTransaction
(boolean commit) Close transaction.describeTable
(String name) Describe table.void
Drop table.int
Execute.Object[]
executeQueryAsArray
(String query, Object... params) Execute query as array.executeQueryAsCachedRowSet
(String query, Object... params) Execute query as cached row set.default double
executeQueryAsDouble
(String query, Object... params) Execute query as double.executeQueryAsIdValue
(String sql, Object... params) Execute query as id value.default int
executeQueryAsInteger
(String query, Object... params) Execute query as integer.executeQueryAsList
(String query, Object... params) Execute query as list.default <T> List<T>
executeQueryAsListOfObjects
(Class<T> clas, String query, Object... params) Execute query as list of objects.default <T> List<T>
executeQueryAsListOfObjects
(Class<T> clas, Map<String, Object> fieldsMapping, String query, Object... params) Execute query as list of objects.default long
executeQueryAsLong
(String query, Object... params) Execute query as integer.executeQueryAsMap
(String sql, Object... params) Execute query as map.default Object[]
executeQueryAsRow
(String query, Object... params) Execute query as row.executeQueryAsString
(String query, Object... params) Execute query as string.executeQueryAsString
(String query, String fieldSeparator, String recordsSepartor, Object... params) Execute query as string.executeSingleOutputQuery
(String query, Object... params) Exeute single output query.executeUpdate
(JKUpdater updater) Execute update.executeUpdate
(JKUpdater updater, boolean ignoreRecordNotFoundException) Execute update.executeUpdate
(String sql, Object... objects) Execute update.<T> T
find
(String query, JKPopulator<T> populator, Object... params) Find.<T> T
findAndCacheRecord
(String tableName, String query, JKPopulator<T> populator, Object... params) Find and cache record.<T> T
findRecord
(JKFinder finder) Find record.<T> T
findRecord
(JKFinder finder, String tableName, Object recordId) Find record.<T> List<T>
Gets the list.<T> List<T>
Gets the list.<T> List<T>
getList
(String query, JKPopulator<T> populator, Object... params) Gets the list.<T> List<T>
getListAndCache
(String tableName, String query, JKPopulator<T> populator, Object... params) Gets the list and cache.Gets the next id.Gets the next id.int
getRowsCount
(String query, Object... params) Gets the rows count.Gets the system date.boolean
isTableExists
(String tableName) Checks if is table exists.void
Run script.
-
Method Details
-
executeQueryAsCachedRowSet
Execute query as cached row set.- Parameters:
query
- the queryparams
- the params- Returns:
- the cached row set
-
executeQueryAsIdValue
Execute query as id value.- Parameters:
sql
- the sqlparams
- the params- Returns:
- the list
-
executeUpdate
Execute update.- Parameters:
updater
- the updater- Returns:
- the int
-
execute
Execute.- Parameters:
sql
- the sqlparams
- the params- Returns:
- the int
-
executeSingleOutputQuery
Exeute single output query.- Parameters:
query
- the queryparams
- the params- Returns:
- the object
-
getNextId
Gets the next id.- Parameters:
tableName
- the table namefieldName
- the field name- Returns:
- the next id
-
getNextId
Gets the next id.- Parameters:
tableName
- the table namefieldName
- the field namecondition
- the condition- Returns:
- the next id
-
getRowsCount
Gets the rows count.- Parameters:
query
- the queryparams
- the params- Returns:
- the rows count
-
executeQueryAsString
Execute query as string.- Parameters:
query
- the queryparams
- the params- Returns:
- the string
-
executeQueryAsString
String executeQueryAsString(String query, String fieldSeparator, String recordsSepartor, Object... params) Execute query as string.- Parameters:
query
- the queryfieldSeparator
- the field separatorrecordsSepartor
- the records separtorparams
- the params- Returns:
- the string
-
executeUpdate
Execute update.- Parameters:
updater
- the updaterignoreRecordNotFoundException
- the ignore record not found exception- Returns:
- the int
-
executeQueryAsList
Execute query as list.- Parameters:
query
- the queryparams
- the params- Returns:
- the list
-
findRecord
Find record.- Type Parameters:
T
- the generic type- Parameters:
finder
- the findertableName
- the table namerecordId
- the record id- Returns:
- the t
-
findRecord
Find record.- Type Parameters:
T
- the generic type- Parameters:
finder
- the finder- Returns:
- the t
-
getSystemDate
Date getSystemDate()Gets the system date.- Returns:
- the system date
-
getList
Gets the list.- Type Parameters:
T
- the generic type- Parameters:
finder
- the finder- Returns:
- the list
-
getList
Gets the list.- Type Parameters:
T
- the generic type- Parameters:
finder
- the finderkey
- the key- Returns:
- the list
-
executeQueryAsArray
Execute query as array.- Parameters:
query
- the queryparams
- the params- Returns:
- the object[]
-
isTableExists
Checks if is table exists.- Parameters:
tableName
- the table typeName- Returns:
- true, if is table exists
-
runScript
Run script.- Parameters:
fileName
- the file name
-
dropTable
Drop table.- Parameters:
string
- the string
-
executeUpdate
Execute update.- Parameters:
sql
- the sqlobjects
- the objects- Returns:
- the object
-
executeQueryAsLong
Execute query as integer.- Parameters:
query
- the queryparams
- the params- Returns:
- the int
-
executeQueryAsDouble
Execute query as double.- Parameters:
query
- the queryparams
- the params- Returns:
- the double
-
executeQueryAsRow
Execute query as row.- Parameters:
query
- the queryparams
- the params- Returns:
- the object[]
-
executeQueryAsListOfObjects
Execute query as list of objects.- Type Parameters:
T
- the generic type- Parameters:
clas
- the clasquery
- the queryparams
- the params- Returns:
- the list
-
executeQueryAsListOfObjects
default <T> List<T> executeQueryAsListOfObjects(Class<T> clas, Map<String, Object> fieldsMapping, String query, Object... params) Execute query as list of objects.- Type Parameters:
T
- the generic type- Parameters:
clas
- the clasfieldsMapping
- the fields mappingquery
- the queryparams
- the params- Returns:
- the list
-
executeQueryAsInteger
Execute query as integer.- Parameters:
query
- the queryparams
- the params- Returns:
- the int
-
find
Find.- Type Parameters:
T
- the generic type- Parameters:
query
- the querypopulator
- the populatorparams
- the params- Returns:
- the t
-
findAndCacheRecord
<T> T findAndCacheRecord(String tableName, String query, JKPopulator<T> populator, Object... params) Find and cache record.- Type Parameters:
T
- the generic type- Parameters:
tableName
- the table namequery
- the querypopulator
- the populatorparams
- the params- Returns:
- the t
-
getList
Gets the list.- Type Parameters:
T
- the generic type- Parameters:
query
- the querypopulator
- the populatorparams
- the params- Returns:
- the list
-
getListAndCache
<T> List<T> getListAndCache(String tableName, String query, JKPopulator<T> populator, Object... params) Gets the list and cache.- Type Parameters:
T
- the generic type- Parameters:
tableName
- the table namequery
- the querypopulator
- the populatorparams
- the params- Returns:
- the list and cache
-
describeTable
Describe table.- Parameters:
name
- the name- Returns:
- the map
-
beginTransaction
void beginTransaction()Begin transaction. -
closeTransaction
void closeTransaction(boolean commit) Close transaction.- Parameters:
commit
- the commit
-
executeQueryAsMap
Execute query as map.- Type Parameters:
T
- the generic type- Parameters:
sql
- the sqlparams
- the params- Returns:
- the map
-