public interface TableManager<B extends BaseBean> extends SqlRunner
| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
TableManager.Action<B> |
| 限定符和类型 | 方法和说明 |
|---|---|
B |
checkDuplicate(B bean)
Check duplicated row by primary keys,if row exists throw exception
|
int |
countAll()
Retrieves the number of rows of the table.
|
int |
countUsingTemplate(B bean)
count the number of elements of a specific bean
|
int |
countUsingTemplate(B bean,
int searchType)
count the number of elements of a specific bean given the search type
|
int |
countWhere(java.lang.String where)
Retrieves the number of rows of the table with a 'where' clause.
|
int |
delete(B... beans)
Delete beans.
|
int |
delete(B bean)
Delete row according to primary keys of bean.
|
int |
delete(java.util.Collection<B> beans)
Delete beans.
|
int |
deleteAll()
Deletes all rows from table.
|
int |
deleteByIndex(java.lang.String indexName,
java.lang.Object... indexValues)
Deletes rows using key.
|
int |
deleteByPrimaryKey(java.lang.Object... keys)
Delete row according to its primary keys.
|
int |
deleteByWhere(java.lang.String where)
Deletes rows from the table using a 'where' clause.
|
int |
deleteImportedBeans(B bean,
java.lang.String fkName)
delete all imported beans by fkName
|
int |
deleteUsingTemplate(B bean)
Deletes rows using a template.
|
boolean |
existsByPrimaryKey(B bean)
Returns true if this table contains row specified by primary key fields of B.
|
boolean |
existsPrimaryKey(java.lang.Object... keys)
Returns true if this table contains row with primary key fields.
|
<T extends BaseBean> |
getImportedBeans(B bean,
java.lang.String fkName)
Retrieves imported T objects by fkIndex.
|
<T extends BaseBean> |
getImportedBeansAsList(B bean,
java.lang.String fkname)
Retrieves imported T objects by ikIndex.
|
<T extends BaseBean> |
getReferencedBean(B bean,
java.lang.String fkName)
Retrieves the T object referenced by fkName.
|
B[] |
loadAll()
Loads all the rows from table.
|
B[] |
loadAll(int startRow,
int numRows)
Loads the given number of rows from table, given the start row.
|
int |
loadAll(int startRow,
int numRows,
TableManager.Action<B> action)
Loads the given number of rows from table, given the start row and dealt with action.
|
int |
loadAll(TableManager.Action<B> action)
Loads each row from table and dealt with action.
|
java.util.List<B> |
loadAllAsList()
Loads all the rows from table.
|
java.util.List<B> |
loadAllAsList(int startRow,
int numRows)
Loads the given number of rows from table, given the start row.
|
B[] |
loadByIndex(java.lang.String indexName,
java.lang.Object... indexValues)
Retrieves a array of B bean using the index specified by keyIndex.
|
java.util.List<B> |
loadByIndexAsList(java.lang.String indexName,
java.lang.Object... indexValues)
Retrieves a list of B bean using the index specified by indexName.
|
B |
loadByPrimaryKey(B bean)
Loads a B bean from the table using primary key fields of
bean. |
B |
loadByPrimaryKey(java.lang.Object... keys)
Loads a B bean from the table using primary key fields.
|
B |
loadByPrimaryKeyChecked(B bean)
see also
loadByPrimaryKey(BaseBean) |
B |
loadByPrimaryKeyChecked(java.lang.Object... keys)
see also
loadByPrimaryKey(Object...) |
B[] |
loadByWhere(java.lang.String where)
Retrieves an array of B given a sql 'where' clause.
|
B[] |
loadByWhere(java.lang.String where,
int[] fieldList)
Retrieves an array of B bean given a sql where clause, and a list of fields.
|
B[] |
loadByWhere(java.lang.String where,
int[] fieldList,
int startRow,
int numRows)
Retrieves an array of B bean given a sql where clause and a list of fields, and startRow and numRows.
|
int |
loadByWhere(java.lang.String where,
int[] fieldList,
int startRow,
int numRows,
TableManager.Action<B> action)
Retrieves each row of B bean given a sql where clause and a list of fields, and startRow and numRows,
and dealt with action.
|
int |
loadByWhere(java.lang.String where,
int[] fieldList,
TableManager.Action<B> action)
Retrieves each row of B bean given a sql where clause, and a list of fields,
and dealt with action.
|
int |
loadByWhere(java.lang.String where,
TableManager.Action<B> action)
Retrieves each row of B bean given a sql 'where' clause and dealt with action.
|
java.util.List<B> |
loadByWhereAsList(java.lang.String where)
Retrieves a list of B bean given a sql 'where' clause.
|
java.util.List<B> |
loadByWhereAsList(java.lang.String where,
int[] fieldList)
Retrieves a list of B bean given a sql where clause, and a list of fields.
|
java.util.List<B> |
loadByWhereAsList(java.lang.String where,
int[] fieldList,
int startRow,
int numRows)
Retrieves a list of B bean given a sql where clause and a list of fields, and startRow and numRows.
|
int |
loadByWhereForAction(java.lang.String where,
int[] fieldList,
int startRow,
int numRows,
TableManager.Action<B> action)
Retrieves each row of B bean given a sql where clause and a list of fields, and startRow and numRows,
and dealt wity action
It is up to you to pass the 'WHERE' in your where clauses.
|
<T> java.util.List<T> |
loadColumnAsList(java.lang.String column,
boolean distinct,
java.lang.String where,
int startRow,
int numRows)
Load column from table.
|
B |
loadUniqueByIndex(java.lang.String indexName,
java.lang.Object... indexValues) |
B |
loadUniqueByIndexChecked(java.lang.String indexName,
java.lang.Object... indexValues) |
B |
loadUniqueUsingTemplate(B bean)
Loads a unique B bean from a template one giving a c
|
B |
loadUniqueUsingTemplateChecked(B bean)
Loads a unique B bean from a template one giving a c
|
B[] |
loadUsingTemplate(B bean)
Loads an array of B from a template one.
|
int |
loadUsingTemplate(B bean,
int[] fieldList,
int startRow,
int numRows,
int searchType,
TableManager.Action<B> action)
Loads each row from a template one, given the start row and number of rows and dealt with action.
|
B[] |
loadUsingTemplate(B bean,
int startRow,
int numRows)
Loads an array of B bean from a template one, given the start row and number of rows.
|
B[] |
loadUsingTemplate(B bean,
int startRow,
int numRows,
int searchType)
Loads a list of B bean from a template one, given the start row and number of rows.
|
int |
loadUsingTemplate(B bean,
int startRow,
int numRows,
TableManager.Action<B> action)
Loads each row from a template one, given the start row and number of rows and dealt with action.
|
int |
loadUsingTemplate(B bean,
TableManager.Action<B> action)
Loads each row from a template one and dealt with action.
|
java.util.List<B> |
loadUsingTemplateAsList(B bean)
Loads a list of B bean from a template one.
|
java.util.List<B> |
loadUsingTemplateAsList(B bean,
int startRow,
int numRows)
Loads a list of B bean from a template one, given the start row and number of rows.
|
java.util.List<B> |
loadUsingTemplateAsList(B bean,
int startRow,
int numRows,
int searchType)
Loads an array of B bean from a template one, given the start row and number of rows.
|
TableListener<B> |
registerListener(TableListener<B> listener)
Registers a unique
TableListener listener. |
B |
save(B bean)
Saves the B bean into the database.
|
B[] |
save(B[] beans)
Saves an array of B bean into the database.
|
B |
save(B bean,
java.util.Map<java.lang.String,BaseBean> referenceBeans,
java.util.Map<java.lang.String,java.util.Collection<BaseBean>> importedBeans)
Save the B bean and referenced beans and imported beans into the database.
|
<C extends java.util.Collection<B>> |
save(C beans)
Saves a collection of B bean into the database as transaction.
|
B[] |
saveAsTransaction(B[] beans)
Saves an array of B bean into the database as transaction.
|
B |
saveAsTransaction(B bean,
java.util.Map<java.lang.String,BaseBean> referenceBeans,
java.util.Map<java.lang.String,java.util.Collection<BaseBean>> importedBeans)
Transaction version for sync save
|
<C extends java.util.Collection<B>> |
saveAsTransaction(C beans)
Saves a collection of B bean into the database.
|
<T extends BaseBean,C extends java.util.Collection<T>> |
setImportedBeans(B bean,
C importedBeans,
java.lang.String fkName)
Set the importedBeans associates to the bean by fkIndex
|
<T extends BaseBean> |
setImportedBeans(B bean,
T[] importedBeans,
java.lang.String fkName)
Set the importedBeans associates to the bean by
ikIndex |
<T extends BaseBean> |
setReferencedBean(B bean,
T beanToSet,
java.lang.String fkName)
Associates the B object to the T object by fkName field.
|
void |
unregisterListener(TableListener<B> listener)
remove listener.
|
runAsTransaction, runAsTransaction, runSqlAsList, runSqlAsList, runSqlForMap, runSqlForValueint countAll() throws RuntimeDaoException
RuntimeDaoExceptionint countUsingTemplate(B bean) throws RuntimeDaoException
bean - the bean to look for ant countRuntimeDaoExceptionint countUsingTemplate(B bean, int searchType) throws RuntimeDaoException
bean - the template to look forsearchType - exact ? like ? starting like ? ending link ? Constant.SEARCH_EXACT Constant.SEARCH_LIKE Constant.SEARCH_STARTING_LIKE Constant.SEARCH_ENDING_LIKE RuntimeDaoExceptionint countWhere(java.lang.String where) throws RuntimeDaoException
where - the restriction clauseRuntimeDaoExceptionint deleteAll() throws RuntimeDaoException
RuntimeDaoExceptionint deleteByWhere(java.lang.String where) throws RuntimeDaoException
where - the sql 'where' clauseRuntimeDaoExceptionint deleteUsingTemplate(B bean) throws RuntimeDaoException
bean - the template object(s) to be deletedRuntimeDaoExceptionint deleteByPrimaryKey(java.lang.Object... keys) throws RuntimeDaoException
keys - primary keys valueRuntimeDaoExceptionint delete(B bean) throws RuntimeDaoException
bean - will be deleted ,all keys must not be nullRuntimeDaoExceptionint delete(B... beans) throws RuntimeDaoException
beans - B array will be deletedRuntimeDaoExceptionint delete(java.util.Collection<B> beans) throws RuntimeDaoException
beans - B collection will be deletedRuntimeDaoExceptionB[] loadAll() throws RuntimeDaoException
RuntimeDaoExceptionint loadAll(TableManager.Action<B> action) throws RuntimeDaoException
action - Action object for do something(not null)RuntimeDaoExceptionB[] loadAll(int startRow, int numRows) throws RuntimeDaoException
startRow - the start row to be used (first row = 1, last row = -1)numRows - the number of rows to be retrieved (all rows = a negative number)RuntimeDaoExceptionint loadAll(int startRow, int numRows, TableManager.Action<B> action) throws RuntimeDaoException
startRow - the start row to be used (first row = 1, last row = -1)numRows - the number of rows to be retrieved (all rows = a negative number)action - Action object for do something(not null)RuntimeDaoExceptionjava.util.List<B> loadAllAsList() throws RuntimeDaoException
RuntimeDaoExceptionjava.util.List<B> loadAllAsList(int startRow, int numRows) throws RuntimeDaoException
startRow - the start row to be used (first row = 1, last row = -1)numRows - the number of rows to be retrieved (all rows = a negative number)RuntimeDaoExceptionB loadByPrimaryKey(B bean) throws RuntimeDaoException
bean.bean - the B bean with primary key fieldsnull if not found or bean is nullRuntimeDaoExceptionB loadByPrimaryKeyChecked(B bean) throws RuntimeDaoException, ObjectRetrievalException
loadByPrimaryKey(BaseBean)bean - ObjectRetrievalException - not foundRuntimeDaoExceptionB loadByPrimaryKey(java.lang.Object... keys) throws RuntimeDaoException
keys - primary keys value:null if not foundRuntimeDaoExceptionB loadByPrimaryKeyChecked(java.lang.Object... keys) throws RuntimeDaoException, ObjectRetrievalException
loadByPrimaryKey(Object...)keys - ObjectRetrievalException - not foundRuntimeDaoExceptionboolean existsPrimaryKey(java.lang.Object... keys) throws RuntimeDaoException
keys - primary keys valueRuntimeDaoExceptionloadByPrimaryKey(Object...)boolean existsByPrimaryKey(B bean) throws RuntimeDaoException
bean - the B bean with primary key fieldsRuntimeDaoExceptionloadByPrimaryKey(BaseBean)B checkDuplicate(B bean) throws RuntimeDaoException, ObjectRetrievalException
bean - the B bean with primary key fieldsObjectRetrievalException - has duplicated recordRuntimeDaoExceptionexistsByPrimaryKey(BaseBean)B[] loadByWhere(java.lang.String where) throws RuntimeDaoException
where - the sql 'where' clauseRuntimeDaoExceptionint loadByWhere(java.lang.String where, TableManager.Action<B> action) throws RuntimeDaoException
where - the sql 'where' clauseaction - Action object for do something(not null)RuntimeDaoExceptionB[] loadByWhere(java.lang.String where, int[] fieldList) throws RuntimeDaoException
where - the sql 'WHERE' clausefieldList - array of field's IDRuntimeDaoExceptionint loadByWhere(java.lang.String where, int[] fieldList, TableManager.Action<B> action) throws RuntimeDaoException
where - the sql 'WHERE' clausefieldList - array of field's IDaction - Action object for do something(not null)RuntimeDaoExceptionB[] loadByWhere(java.lang.String where, int[] fieldList, int startRow, int numRows) throws RuntimeDaoException
where - the sql 'where' clausefieldList - table of the field's associated constantsstartRow - the start row to be used (first row = 1, last row = -1)numRows - the number of rows to be retrieved (all rows = a negative number)RuntimeDaoExceptionint loadByWhere(java.lang.String where, int[] fieldList, int startRow, int numRows, TableManager.Action<B> action) throws RuntimeDaoException
where - the sql 'where' clausefieldList - table of the field's associated constantsstartRow - the start row to be used (first row = 1, last row = -1)numRows - the number of rows to be retrieved (all rows = a negative number)action - Action object for do something(not null)RuntimeDaoExceptionjava.util.List<B> loadByWhereAsList(java.lang.String where) throws RuntimeDaoException
where - the sql 'where' clauseRuntimeDaoExceptionjava.util.List<B> loadByWhereAsList(java.lang.String where, int[] fieldList) throws RuntimeDaoException
where - the sql 'WHERE' clausefieldList - array of field's IDRuntimeDaoExceptionjava.util.List<B> loadByWhereAsList(java.lang.String where, int[] fieldList, int startRow, int numRows) throws RuntimeDaoException
where - the sql 'where' clausefieldList - table of the field's associated constantsstartRow - the start row to be used (first row = 1, last row = -1)numRows - the number of rows to be retrieved (all rows = a negative number)RuntimeDaoExceptionint loadByWhereForAction(java.lang.String where, int[] fieldList, int startRow, int numRows, TableManager.Action<B> action) throws RuntimeDaoException
where - the sql 'where' clausefieldList - table of the field's associated constantsstartRow - the start row to be used (first row = 1, last row = -1)numRows - the number of rows to be retrieved (all rows = a negative number)action - Action object for do something(not null)RuntimeDaoExceptionB loadUniqueUsingTemplate(B bean) throws RuntimeDaoException
bean - the B bean to look fornull if not found or null input argumentObjectRetrievalException - more than one rowRuntimeDaoExceptionB loadUniqueUsingTemplateChecked(B bean) throws RuntimeDaoException, ObjectRetrievalException
bean - the B bean to look forObjectRetrievalException - not found or more than one rowRuntimeDaoExceptionB[] loadUsingTemplate(B bean) throws RuntimeDaoException
bean - the B bean template to look forRuntimeDaoExceptionint loadUsingTemplate(B bean, TableManager.Action<B> action) throws RuntimeDaoException
bean - the B bean template to look foraction - Action object for do something(not null)RuntimeDaoExceptionB[] loadUsingTemplate(B bean, int startRow, int numRows) throws RuntimeDaoException
bean - the B bean template to look forstartRow - the start row to be used (first row = 1, last row=-1)numRows - the number of rows to be retrieved (all rows = a negative number)RuntimeDaoExceptionint loadUsingTemplate(B bean, int startRow, int numRows, TableManager.Action<B> action) throws RuntimeDaoException
bean - the B bean template to look forstartRow - the start row to be used (first row = 1, last row=-1)numRows - the number of rows to be retrieved (all rows = a negative number)action - Action object for do something(not null)RuntimeDaoExceptionint loadUsingTemplate(B bean, int[] fieldList, int startRow, int numRows, int searchType, TableManager.Action<B> action) throws RuntimeDaoException
bean - the B template to look forfieldList - table of the field's associated constantsstartRow - the start row to be used (first row = 1, last row=-1)numRows - the number of rows to be retrieved (all rows = a negative number)searchType - exact ? like ? starting like ? ending link ? Constant.SEARCH_EXACT Constant.SEARCH_LIKE Constant.SEARCH_STARTING_LIKE Constant.SEARCH_ENDING_LIKE action - Action object for do something(not null)RuntimeDaoExceptionB[] loadUsingTemplate(B bean, int startRow, int numRows, int searchType) throws RuntimeDaoException
bean - the B bean template to look forstartRow - the start row to be used (first row = 1, last row=-1)numRows - the number of rows to be retrieved (all rows = a negative number)searchType - exact ? like ? starting like ? ending link ? Constant.SEARCH_EXACT Constant.SEARCH_LIKE Constant.SEARCH_STARTING_LIKE Constant.SEARCH_ENDING_LIKE RuntimeDaoExceptionjava.util.List<B> loadUsingTemplateAsList(B bean) throws RuntimeDaoException
bean - the B bean template to look forRuntimeDaoExceptionjava.util.List<B> loadUsingTemplateAsList(B bean, int startRow, int numRows) throws RuntimeDaoException
bean - the B bean template to look forstartRow - the start row to be used (first row = 1, last row=-1)numRows - the number of rows to be retrieved (all rows = a negative number)RuntimeDaoExceptionjava.util.List<B> loadUsingTemplateAsList(B bean, int startRow, int numRows, int searchType) throws RuntimeDaoException
bean - the B bean template to look forstartRow - the start row to be used (first row = 1, last row=-1)numRows - the number of rows to be retrieved (all rows = a negative number)searchType - exact ? like ? starting like ? ending link? Constant.SEARCH_EXACT Constant.SEARCH_LIKE Constant.SEARCH_STARTING_LIKE Constant.SEARCH_ENDING_LIKE RuntimeDaoExceptionB[] loadByIndex(java.lang.String indexName, java.lang.Object... indexValues) throws RuntimeDaoException
indexName - name of indexindexValues - key values of indexRuntimeDaoException#loadByIndexAsList(int ,Object ...)java.util.List<B> loadByIndexAsList(java.lang.String indexName, java.lang.Object... indexValues) throws RuntimeDaoException
indexName - name of indexindexValues - key values of indexRuntimeDaoExceptionB loadUniqueByIndex(java.lang.String indexName, java.lang.Object... indexValues) throws RuntimeDaoException
B loadUniqueByIndexChecked(java.lang.String indexName, java.lang.Object... indexValues) throws ObjectRetrievalException
int deleteByIndex(java.lang.String indexName, java.lang.Object... indexValues) throws RuntimeDaoException
indexName - name of indexindexValues - key values of indexRuntimeDaoExceptionTableListener<B> registerListener(TableListener<B> listener)
listener - void unregisterListener(TableListener<B> listener)
listener - B save(B bean) throws RuntimeDaoException
bean - the B bean to be savedRuntimeDaoExceptionB[] save(B[] beans) throws RuntimeDaoException
beans - the array of B bean to be savedRuntimeDaoException<C extends java.util.Collection<B>> C saveAsTransaction(C beans) throws RuntimeDaoException
beans - the B bean table to be savedRuntimeDaoExceptionB[] saveAsTransaction(B[] beans) throws RuntimeDaoException
beans - the B bean table to be savedRuntimeDaoExceptionsave(BaseBean[])<C extends java.util.Collection<B>> C save(C beans) throws RuntimeDaoException
beans - the B bean table to be savedRuntimeDaoExceptionB save(B bean, java.util.Map<java.lang.String,BaseBean> referenceBeans, java.util.Map<java.lang.String,java.util.Collection<BaseBean>> importedBeans) throws RuntimeDaoException
bean - the B bean to be savedreferenceBeans - referenced beans beansimportedBeans - imported beans RuntimeDaoExceptionB saveAsTransaction(B bean, java.util.Map<java.lang.String,BaseBean> referenceBeans, java.util.Map<java.lang.String,java.util.Collection<BaseBean>> importedBeans) throws RuntimeDaoException
bean - the B bean to be savedreferenceBeans - referenced beans beansimportedBeans - imported beans RuntimeDaoExceptionsave(BaseBean ,Map,Map)<T> java.util.List<T> loadColumnAsList(java.lang.String column, boolean distinct, java.lang.String where, int startRow, int numRows) throws RuntimeDaoException
column - column name or java file name of Bdistinct - select distinct valueswhere - the sql 'where' clausestartRow - the start row to be used (first row = 1, last row = -1)numRows - the number of rows to be retrieved (all rows = a negative number)RuntimeDaoException<T extends BaseBean> T getReferencedBean(B bean, java.lang.String fkName) throws RuntimeDaoException
T - bean - the B object to usefkName - foreign key name.null if bean is nullRuntimeDaoException<T extends BaseBean> T setReferencedBean(B bean, T beanToSet, java.lang.String fkName) throws RuntimeDaoException
T - see also getReferencedBean(BaseBean, String)bean - the B object to usebeanToSet - the T object to associate to the B beanfkName - see also getReferencedBean(BaseBean, String)RuntimeDaoException<T extends BaseBean> T[] getImportedBeans(B bean, java.lang.String fkName) throws RuntimeDaoException
T - bean - the B object to usefkName - foreign key name.null if bean is nullRuntimeDaoException<T extends BaseBean> java.util.List<T> getImportedBeansAsList(B bean, java.lang.String fkname) throws RuntimeDaoException
T - see also getImportedBeans(BaseBean, String)bean - the B object to usefkname - foreign key name.see also getImportedBeans(BaseBean, String)null if bean is nullRuntimeDaoException<T extends BaseBean> T[] setImportedBeans(B bean, T[] importedBeans, java.lang.String fkName) throws RuntimeDaoException
ikIndexT - see also getImportedBeans(BaseBean, String)bean - the bean object to useimportedBeans - the T object to associate to beanfkName - foreign key name.see also getImportedBeans(BaseBean, String)RuntimeDaoException<T extends BaseBean,C extends java.util.Collection<T>> C setImportedBeans(B bean, C importedBeans, java.lang.String fkName) throws RuntimeDaoException
T - see also getImportedBeans(BaseBean, String)bean - the bean object to useimportedBeans - the T object to associate to beanfkName - foreign key name. see also getImportedBeans(BaseBean, String)RuntimeDaoExceptionint deleteImportedBeans(B bean, java.lang.String fkName) throws RuntimeDaoException
bean - fkName - foreign key nameRuntimeDaoExceptionCopyright © 2019. All Rights Reserved.