| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
TableManager.Action<B> |
static interface |
TableManager.DoEach<B>
interface for iterate
|
| 限定符和类型 | 方法和说明 |
|---|---|
B |
addIfAbsent(B bean)
If the specified key is not already exist, add it to database.
|
B |
checkDuplicate(B bean)
Check duplicated row by primary keys,if row exists throw exception
|
java.util.List<B> |
childListOfSelfRef(java.lang.String fkName,
B bean)
return child bean list (self included) by the self-reference field specified by fkName
throw RuntimeDaoException if self-reference field is cycle |
java.util.List<B> |
childListOfSelfRef(java.lang.String fkName,
java.lang.Object... primaryKeys)
return child bean list (self included) by the self-reference field specified by fkName
throw RuntimeDaoException if self-reference field is cycle |
java.util.Set<B> |
childrenOfBeansOfSelfRef(java.lang.String fkName,
java.lang.Iterable<B> beans)
return child bean list (self included) by the self-reference field specified by fkName
throw RuntimeDaoException if self-reference field is cycle |
<T> java.util.Set<B> |
childrenOfPksOfSelfRef(java.lang.String fkName,
java.lang.Iterable<T> primaryKeys)
return child bean list (self included) by the self-reference field specified by fkName
throw RuntimeDaoException if self-reference field is cycle |
java.util.Set<B> |
childrenOfSelfRef(java.lang.String fkName,
B bean)
return child bean list (self included) by the self-reference field specified by fkName
throw RuntimeDaoException if self-reference field is cycle |
java.util.Set<B> |
childrenOfSelfRef(java.lang.String fkName,
java.lang.Object... primaryKeys)
return child bean list (self included) by the self-reference field specified by fkName
throw RuntimeDaoException if self-reference field is cycle |
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.
|
B |
createBean()
Creates a new B instance.
|
B |
createBeanWithPimaryKeys(boolean returnNullIfNullElement,
java.lang.Object... primaryValues)
Creates a new B instance.
|
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 |
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 |
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.
|
<C extends java.lang.Iterable<B>> |
fastInsert(int[] fieldList,
C beans)
Insert the B bean list into the database.
|
void |
foreach(TableManager.DoEach<B> each,
boolean stopOnError)
Retrieves each row of B bean given a SQL where clause and a list of fields,
and dealt with each action.
|
void |
foreachByJoinWhere(TableManager.DoEach<B> each,
boolean stopOnError,
java.lang.String join,
java.lang.String where)
Retrieves each row of B bean given a SQL where clause and a list of fields,
and dealt with each action.
|
void |
foreachByWhere(TableManager.DoEach<B> each,
boolean stopOnError,
java.lang.String where)
Retrieves each row of B bean given a SQL where clause and a list of fields,
and dealt with each action.
|
IDataSourceConfig |
getDataSourceConfig() |
GeometryDataCodec |
getGeometryDataCodec() |
ListenerContainer<B> |
getListenerContainer() |
java.util.List<B> |
listOfSelfRef(java.lang.String fkName,
B bean)
return bean list ( include
bean ) by the self-reference field specified by fkNamefirst element is top bean |
java.util.List<B> |
listOfSelfRef(java.lang.String fkName,
java.lang.Object... primaryKeys)
return bean list ( include bean specified by
primaryKeys ) by the self-reference field specified by fkNamefirst element is top bean |
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.
|
java.util.List<B> |
loadByJoinWhereAsList(java.lang.String join,
java.lang.String where)
已过时。
replaced by
loadByJoinWhereAsList(String, String, Supplier),since 3.35.0 |
java.util.List<B> |
loadByJoinWhereAsList(java.lang.String join,
java.lang.String where,
int[] fieldList,
int startRow,
int numRows)
已过时。
replaced by
loadByJoinWhereAsList(String, String, int[], int, int, Supplier),since 3.35.0 |
java.util.List<B> |
loadByJoinWhereAsList(java.lang.String join,
java.lang.String where,
int[] fieldList,
int startRow,
int numRows,
com.google.common.base.Supplier<IManagerContext> contextSupplier)
根据 JOIN 和 WHERE 条件执行查询,并将查询结果转换为 B 类型的列表返回。
|
java.util.List<B> |
loadByJoinWhereAsList(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList)
已过时。
replaced by
loadByJoinWhereAsList(String, String, Object[], int[], Supplier),since 3.35.0 |
<T> java.util.List<T> |
loadByJoinWhereAsList(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int startRow,
int numRows,
com.google.common.base.Function<B,T> transformer)
已过时。
replaced by
loadByJoinWhereAsList(String, String, Object[], int[], int, int, Function, Supplier),since 3.35.0 |
<T> java.util.List<T> |
loadByJoinWhereAsList(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int startRow,
int numRows,
com.google.common.base.Function<B,T> transformer,
com.google.common.base.Supplier<IManagerContext> contextSupplier)
根据 JOIN 和 WHERE 条件执行查询,并将查询结果转换为指定类型的列表返回。
|
java.util.List<B> |
loadByJoinWhereAsList(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
com.google.common.base.Supplier<IManagerContext> contextSupplier)
根据 JOIN 和 WHERE 条件执行查询,并将查询结果转换为 B 类型的列表返回。
|
java.util.List<B> |
loadByJoinWhereAsList(java.lang.String join,
java.lang.String where,
com.google.common.base.Supplier<IManagerContext> contextSupplier)
根据 JOIN 和 WHERE 条件执行查询,并将查询结果转换为 B 类型的列表返回。
|
int |
loadByJoinWhereForAction(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int startRow,
int numRows,
TableManager.Action<B> action)
已过时。
replaced by
loadByJoinWhereForAction(String, String, Object[], int[], int, int, Action, Supplier),since 3.35.0 |
int |
loadByJoinWhereForAction(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int startRow,
int numRows,
TableManager.Action<B> action,
com.google.common.base.Supplier<IManagerContext> contextSupplier)
根据 JOIN 和 WHERE 条件执行查询,并对查询结果执行指定操作。
|
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,
java.lang.Object[] argList,
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.
|
boolean |
lockAndUpdate(B bean)
锁定并更新指定的
bean。 |
java.util.List<B> |
lockAndUpdate(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int lockLimit,
LockUpateRunner<B> updateRunner)
|
java.util.List<B> |
lockAndUpdate(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int lockLimit,
LockUpateRunner<B> updateRunner,
com.google.common.base.Supplier<IManagerContext> contextSupplier)
锁定符合条件的行并根据锁定的行执行指定的更新操作。
|
java.util.List<B> |
lockAndUpdate(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int limit,
LockUpateRunner<B> updateRunner)
|
java.util.List<B> |
lockAndUpdate(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int limit,
LockUpateRunner<B> updateRunner,
com.google.common.base.Supplier<IManagerContext> contextSupplier)
锁定符合条件的行并根据锁定的行执行指定的更新操作。
|
void |
registerListener(TableListener<B> listener)
Registers a unique
TableListener listener. |
int |
rowCountWhere(java.lang.String where,
java.lang.Object... argList)
Retrieves the number of rows of the table with a 'where' clause.
|
B |
save(B bean)
Saves the B bean into the database.
|
B[] |
save(B[] beans)
Saves an array of B bean 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.
|
<C extends java.util.Collection<B>> |
saveAsTransaction(C beans)
Saves a collection of B bean into the database.
|
boolean |
setValueIfNonEqual(B bean,
java.lang.String column,
java.lang.Object value)
set a value to the given field in bean if value is not equal to the given field of old record in database
|
boolean |
setValueIfNonNull(B bean,
java.lang.String column,
java.lang.Object value)
set a value to the given field in bean if the given field of old record in database is not null
|
java.util.List<B> |
tryLockRows(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int lockLimit,
Constant.RowLockType rowLockType)
|
java.util.List<B> |
tryLockRows(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int lockLimit,
Constant.RowLockType rowLockType,
com.google.common.base.Supplier<IManagerContext> contextSupplier)
(悲观锁)尝试锁定满足条件的行。
|
void |
unregisterListener(TableListener<B> listener)
remove listener.
|
int |
updateWithCondition(B bean,
java.lang.String extraUpdateExp,
java.lang.Object[] extraUpdateExpArgList)
根据指定条件更新数据库中 B 类型的 bean 记录。
|
rowCountOf, runAsTransaction, runAsTransaction, runSql, runSql, runSqlAsList, runSqlAsList, runSqlAsList, runSqlForMap, runSqlForValue, runWithNoPage, runWithNoPageB createBean()
B createBeanWithPimaryKeys(boolean returnNullIfNullElement, java.lang.Object... primaryValues)
returnNullIfNullElement - return null if exist null elementprimaryValues - values of primary keysint 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 rowCountWhere(java.lang.String where,
java.lang.Object... argList)
throws RuntimeDaoException
where - the restriction clauseargList - the arguments to use fill given prepared statement,may be nullRuntimeDaoExceptionint 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 deletedRuntimeDaoExceptionboolean setValueIfNonNull(B bean, java.lang.String column, java.lang.Object value)
bean - column - column namevalue - boolean setValueIfNonEqual(B bean, java.lang.String column, java.lang.Object value)
bean - column - column namevalue - B[] 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,
java.lang.Object[] argList,
int[] fieldList,
int startRow,
int numRows,
TableManager.Action<B> action)
throws RuntimeDaoException
where - the sql 'where' clauseargList - the arguments to use fill given prepared statement,may be nullfieldList - 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> loadByJoinWhereAsList(java.lang.String join, java.lang.String where, com.google.common.base.Supplier<IManagerContext> contextSupplier) throws RuntimeDaoException
loadByJoinWhereAsList(String, String, Object[], int[], int, int, Function, Supplier) 的便捷方法。loadByJoinWhereAsList(join, where, null, null, 1, -1, Functions.identity(), contextSupplier);
join - JOIN 子句,用于表连接操作,可传入 null 或空字符串表示不使用 JOIN。where - WHERE 条件表达式,需以 'WHERE' 开头,也可以为 null 或空字符串。contextSupplier - 管理器上下文提供者,用于提供查询所需的上下文信息。可为 null。RuntimeDaoException - 当数据访问发生异常时抛出。java.util.List<B> loadByJoinWhereAsList(java.lang.String join, java.lang.String where) throws RuntimeDaoException
loadByJoinWhereAsList(String, String, Supplier),since 3.35.0join - the sql 'join' clausewhere - the sql 'where' clauseRuntimeDaoExceptionjava.util.List<B> loadByJoinWhereAsList(java.lang.String join, java.lang.String where, java.lang.Object[] argList, int[] fieldList, com.google.common.base.Supplier<IManagerContext> contextSupplier) throws RuntimeDaoException
join - JOIN 子句,用于表连接操作,可传入 null 或空字符串表示不使用 JOIN。where - WHERE 条件表达式,需以 'WHERE' 开头,也可以为 null 或空字符串。argList - WHERE 条件中的参数列表,用于填充 SQL 语句中的占位符 '?'。fieldList - 要查询的字段 ID 列表,可传入 null 或空数组表示查询所有字段。contextSupplier - 管理器上下文提供者,用于提供查询所需的上下文信息。可为 null。RuntimeDaoException - 当数据访问发生异常时抛出。java.util.List<B> loadByJoinWhereAsList(java.lang.String join, java.lang.String where, java.lang.Object[] argList, int[] fieldList) throws RuntimeDaoException
loadByJoinWhereAsList(String, String, Object[], int[], Supplier),since 3.35.0join - the sql 'join' clausewhere - the sql 'WHERE' clauseargList - the arguments to use fill given prepared statement,may be nullfieldList - array of field's IDRuntimeDaoExceptionjava.util.List<B> loadByJoinWhereAsList(java.lang.String join, java.lang.String where, int[] fieldList, int startRow, int numRows, com.google.common.base.Supplier<IManagerContext> contextSupplier) throws RuntimeDaoException
loadByJoinWhereAsList(String, String, Object[], int[], int, int, Function, Supplier)的便利方法loadByJoinWhereAsList(join, where, null, fieldList, startRow, numRows, Functions.identity(), contextSupplier);
join - JOIN 子句,用于表连接操作,可传入 null 或空字符串表示不使用 JOIN。where - WHERE 条件表达式,需以 'WHERE' 开头,也可以为 null 或空字符串。fieldList - 要查询的字段 ID 列表,可传入 null 或空数组表示查询所有字段。startRow - 查询结果的起始行号,从 1 开始计数。numRows - 要查询的行数,-1 表示查询所有行。contextSupplier - 管理器上下文提供者,用于提供查询所需的上下文信息。可为 null。RuntimeDaoException - 当数据访问发生异常时抛出。java.util.List<B> loadByJoinWhereAsList(java.lang.String join, java.lang.String where, int[] fieldList, int startRow, int numRows) throws RuntimeDaoException
loadByJoinWhereAsList(String, String, int[], int, int, Supplier),since 3.35.0join - the sql 'join' clausewhere - 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)RuntimeDaoException<T> java.util.List<T> loadByJoinWhereAsList(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int startRow,
int numRows,
com.google.common.base.Function<B,T> transformer,
com.google.common.base.Supplier<IManagerContext> contextSupplier)
throws RuntimeDaoException
join - JOIN 子句,用于表连接操作,可传入 null 或空字符串表示不使用 JOIN。where - WHERE 条件表达式,需以 'WHERE' 开头,也可以为 null 或空字符串。argList - WHERE 条件中的参数列表,用于填充 SQL 语句中的占位符 '?'。fieldList - 要查询的字段 ID 列表,可传入 null 或空数组表示查询所有字段。startRow - 查询结果的起始行号,从 1 开始计数。numRows - 要查询的行数,-1 表示查询所有行。transformer - 用于将查询结果的 B 类型对象转换为 T 类型对象的转换器。contextSupplier - 管理器上下文提供者,用于提供查询所需的上下文信息。可为 null。RuntimeDaoException - 当数据访问发生异常时抛出。<T> java.util.List<T> loadByJoinWhereAsList(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int startRow,
int numRows,
com.google.common.base.Function<B,T> transformer)
throws RuntimeDaoException
loadByJoinWhereAsList(String, String, Object[], int[], int, int, Function, Supplier),since 3.35.0join - the sql 'join' clausewhere - the sql 'where' clauseargList - the arguments to use fill given prepared statement,may be nullfieldList - 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)transformer - cast B to TRuntimeDaoExceptionint loadByJoinWhereForAction(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int startRow,
int numRows,
TableManager.Action<B> action,
com.google.common.base.Supplier<IManagerContext> contextSupplier)
throws RuntimeDaoException
join - JOIN 子句,用于表连接操作,可传入 null 或空字符串表示不使用 JOIN。where - WHERE 条件表达式,需以 'WHERE' 开头,也可以为 null 或空字符串。argList - WHERE 条件中的参数列表,用于填充 SQL 语句中的占位符 '?'。fieldList - 要查询的字段 ID 列表,可传入 null 或空数组表示查询所有字段。startRow - 查询结果的起始行号,从 1 开始计数。numRows - 要查询的行数,-1 表示查询所有行。action - 对查询结果执行的操作,每个结果行都会调用该操作。contextSupplier - 管理器上下文提供者,用于提供查询所需的上下文信息。可为 null。RuntimeDaoException - 当数据访问发生异常时抛出。int loadByJoinWhereForAction(java.lang.String join,
java.lang.String where,
java.lang.Object[] argList,
int[] fieldList,
int startRow,
int numRows,
TableManager.Action<B> action)
throws RuntimeDaoException
loadByJoinWhereForAction(String, String, Object[], int[], int, int, Action, Supplier),since 3.35.0join - the sql 'join' clausewhere - the sql 'where' clauseargList - the arguments to use fill given prepared statement,may be nullfieldList - 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 RuntimeDaoExceptionvoid foreachByWhere(TableManager.DoEach<B> each, boolean stopOnError, java.lang.String where) throws RuntimeDaoException
each - DoForEach object for do something(not null)stopOnError - stop on errorwhere - the SQL 'where' clause, retrieves all rows if null or emptyRuntimeDaoExceptionvoid foreachByJoinWhere(TableManager.DoEach<B> each, boolean stopOnError, java.lang.String join, java.lang.String where) throws RuntimeDaoException
each - DoForEach object for do something(not null)stopOnError - stop on errorjoin - the sql 'join' clausewhere - the SQL 'where' clause, retrieves all rows if null or emptyRuntimeDaoExceptionvoid foreach(TableManager.DoEach<B> each, boolean stopOnError) throws RuntimeDaoException
each - DoForEach object for do something(not null)stopOnError - stop on errorRuntimeDaoExceptionvoid registerListener(TableListener<B> listener)
listener - void unregisterListener(TableListener<B> listener)
listener - B save(B bean) throws RuntimeDaoException
bean - the B bean to be savedRuntimeDaoExceptionB addIfAbsent(B bean) throws RuntimeDaoException
if (!existsByPrimaryKey(bean))
return insert(bean);
else
return loadByPrimaryKey(bean);
except that the action is performed atomically .bean - the B bean to be savednull if bean is nullRuntimeDaoExceptionB[] 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 savedRuntimeDaoException<C extends java.lang.Iterable<B>> void fastInsert(int[] fieldList, C beans)
TableListenerfieldList - table of the field's associated constants,if null as all fieldbeans - the B bean list to be savedRuntimeDaoException<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)RuntimeDaoExceptionListenerContainer<B> getListenerContainer()
IDataSourceConfig getDataSourceConfig()
GeometryDataCodec getGeometryDataCodec()
java.util.List<B> lockAndUpdate(java.lang.String join, java.lang.String where, java.lang.Object[] argList, int[] fieldList, int lockLimit, LockUpateRunner<B> updateRunner, com.google.common.base.Supplier<IManagerContext> contextSupplier) throws RuntimeDaoException
该方法会在事务中尝试锁定符合条件的行,若成功锁定则调用传入的更新操作对锁定的行进行更新。
如果没有锁定到任何行,返回空表。
NOTE:锁定成功传递给更新操作的行对象(updateRunner)的锁定行对象中仅包含的字段由fieldList决定。
示例:
String extraLimitExp = "(SELECT COUNT(*) FROM (SELECT coupon_id FROM test.t_coupon WHERE user_id = ? AND coupon_name=?) as c2)<1";
Object[] extraLimitExpArgList = new Object[] {lockUserId, couponName};
// 锁定t_coupon表中user_id字段为null的1行,锁定成功则更新锁定行,将当前用户ID写入锁定行的user_id,代表当前用户占有此记录。
// 在更新锁定行时,extraLimitExp表达判断t_coupon表中是否已经存在user_id为当前用户的记录,如果是则更新失败。
// 这样就确保t_coupon表中只有一条被当前用户占有的记录,即只能抢到一张优惠券。
List<CouponBean> lockedCouponId = couponManager.lockAndUpdate("",
builder.toString(), argList, new int[] {0},1,
(lockedRows) -> {
for(Iterator<CouponBean> itor=lockedRows.iterator(); itor.hasNext();){
CouponBean r = itor.next();
r.setUserId(lockUserId);
if (couponManager.updateWithCondition(r, extraLimitExp, extraLimitExpArgList) == 0) {
// 更新失败删除当前元素
itor.remove();
}
}
});
join - 连接条件,用于表连接操作。为 null 时不添加连接条件。where - 筛选条件,用于过滤符合条件的行。为 null 时不添加筛选条件。argList - 参数列表,用于填充where语句中的占位符。为 null 则不填充。fieldList - 字段列表,指定要查询的字段。为 null 时查询所有字段。lockLimit - 锁定行数限制,若大于0,则锁定符合条件的前N行。为0时,锁定符合条件的所有行。updateRunner - 行更新逻辑,用于根据锁定的行执行更新逻辑,为 null时无效。contextSupplier - 管理器上下文提供者,用于提供查询所需的上下文信息。RuntimeDaoException - 执行过程中出现运行时数据访问异常时抛出。java.util.List<B> lockAndUpdate(java.lang.String join, java.lang.String where, java.lang.Object[] argList, int[] fieldList, int lockLimit, LockUpateRunner<B> updateRunner) throws RuntimeDaoException
lockAndUpdate(String, String, Object[], int[], int, LockUpateRunner, Supplier)的便利方法。
等价于:
lockAndUpdate(join, where, argList, fieldList, lockLimit, updateRunner, null);
join - 连接条件,用于表连接操作。where - 筛选条件,用于过滤符合条件的行。argList - 参数列表,用于填充where语句中的占位符。为 null 则不填充。fieldList - 字段列表,指定要查询的字段。为 null 时查询所有字段。lockLimit - 锁定行数限制,若大于0,则锁定符合条件的前N行。为0时,锁定符合条件的所有行。updateRunner - 行更新逻辑,用于对锁定的行进行更新,不能为 null。RuntimeDaoException - 执行过程中出现运行时数据访问异常时抛出。java.util.List<B> lockAndUpdate(java.lang.String join, java.lang.String where, java.lang.Object[] argList, int limit, LockUpateRunner<B> updateRunner, com.google.common.base.Supplier<IManagerContext> contextSupplier) throws RuntimeDaoException
该方法会在事务中尝试锁定符合条件的行,若成功锁定则调用传入的更新操作对锁定的行进行更新。
如果没有锁定到任何行,返回空表。
NOTE:锁定成功传递给更新操作的行对象(updateRunner)的锁定行对象中仅包含主键字段。
join - 连接条件,用于表连接操作。where - 筛选条件,用于过滤符合条件的行。argList - 参数列表,用于填充where语句中的占位符。为 null 则不填充。limit - 锁定行数限制,若大于0,则锁定符合条件的前N行。为0时,锁定符合条件的所有行。updateRunner - 行更新逻辑,用于对锁定的行进行更新,不能为 null。contextSupplier - 管理器上下文提供者,用于提供查询所需的上下文信息。RuntimeDaoException - 执行过程中出现运行时数据访问异常时抛出。java.util.List<B> lockAndUpdate(java.lang.String join, java.lang.String where, java.lang.Object[] argList, int limit, LockUpateRunner<B> updateRunner) throws RuntimeDaoException
lockAndUpdate(String, String, Object[], int, LockUpateRunner, Supplier)的便利方法
等价于:
return lockAndUpdate(join, where, argList, limit, updateRunner, null);
join - 连接条件,用于表连接操作。为 null 时不添加连接条件。where - 筛选条件,用于过滤符合条件的行。为 null 时不添加筛选条件。argList - 参数列表,用于填充where语句中的占位符。为 null 则不填充。limit - 锁定并更新的最大行数updateRunner - 用于执行更新操作的执行器RuntimeDaoException - 运行时数据访问异常boolean lockAndUpdate(B bean) throws RuntimeDaoException
bean。
该方法会先检查传入的bean:
如果为空或为新记录,返回false。如果bean的主键存在空值则抛出 RuntimeDaoException 异常。
接着会根据bean的主键生成 WHERE 条件,
调用 lockAndUpdate(String, String, Object[], int[], int, LockUpateRunner) 方法进行锁定并更新操作。
若锁定过程中出现问题,返回false。
bean - 要锁定并更新的记录,类型为 B。RuntimeDaoException - 当传入的bean为空或主键存在空值时抛出。int updateWithCondition(B bean, java.lang.String extraUpdateExp, java.lang.Object[] extraUpdateExpArgList) throws RuntimeDaoException
该方法会根据传入的 bean 对象的修改信息生成更新语句,同时可以结合额外的更新条件进行更新操作。
如果 bean 为 null 或者没有被修改,则不会进行更新操作,直接返回 0。
如果 bean 是新创建的,也不会进行更新操作,直接返回 0。
如果表存在乐观锁字段,会在更新时进行乐观锁检查。
bean - 要更新的 B 类型的 bean 对象extraUpdateExp - 额外的更新条件表达式,可为 nullextraUpdateExpArgList - 额外更新条件表达式对应的参数列表,可为 nullRuntimeDaoException - 当发生数据库操作异常时抛出java.util.List<B> tryLockRows(java.lang.String join, java.lang.String where, java.lang.Object[] argList, int[] fieldList, int lockLimit, Constant.RowLockType rowLockType, com.google.common.base.Supplier<IManagerContext> contextSupplier) throws RuntimeDaoException
该方法适用于事务中执行,锁定满足查询条件的行,用于后续记录更新操作
最终返回被锁定的行对应的 Java Bean 列表。
示例:
// 尝试锁定t_coupon表中满足user_id为null的1行,行锁定类型为 FOR_UPDATE // 等价执行 SQL:SELECT coupon_id FROM test.t_coupon WHERE user_id IS NULL LIMIT 1 FOR UPDATE Listlist = couponManager.tryLockRows(null, "WHERE user_id IS NULL", null, new int[]{0}, 1, RowLockType.FOR_UPDATE);
join - 连接条件,用于表连接操作。为 null 时不添加连接条件。where - 筛选条件,用于过滤符合条件的行。为 null 时不添加筛选条件。argList - 参数列表,用于填充where语句中的占位符。为 null 则不填充。fieldList - 字段列表,指定要查询的字段。为 null 时查询所有字段。lockLimit - 锁定的最大行数rowLockType - 行锁定类型contextSupplier - 管理器上下文提供者,用于提供查询所需的上下文信息。RuntimeDaoException - 运行时数据访问异常java.util.List<B> tryLockRows(java.lang.String join, java.lang.String where, java.lang.Object[] argList, int[] fieldList, int lockLimit, Constant.RowLockType rowLockType) throws RuntimeDaoException
tryLockRows(String, String, Object[], int[], int, Constant.RowLockType, Supplier)
等价于:tryLockRows(join, where, argList, fieldList, lockLimit, rowLockType, null);
join - JOIN 子句,用于表连接操作,可传入 null 或空字符串表示不使用 JOIN。where - WHERE 条件表达式,需以 'WHERE' 开头,也可以为 null 或空字符串。argList - WHERE 条件中的参数列表,用于填充 SQL 语句中的占位符 '?',可为 null。fieldList - 要查询的字段 ID 列表,可传入 null 或空数组表示查询所有字段。lockLimit - 要锁定的最大行数限制。rowLockType - 行锁类型,指定锁定行的方式。RuntimeDaoException - 当数据访问发生异常时抛出。B loadUniqueByIndexChecked(java.lang.String indexName, java.lang.Object... indexValues) throws ObjectRetrievalException
如果索引值包含 null,将抛出 ObjectRetrievalException 异常。
indexName - 索引名称indexValues - 索引值数组ObjectRetrievalException - 当索引值包含 null 或加载记录失败时抛出B loadUniqueByIndex(java.lang.String indexName, java.lang.Object... indexValues) throws RuntimeDaoException
该方法会根据指定的索引名称和对应的索引值,从数据库中查询并返回唯一匹配的记录。 如果索引值包含 null,则返回 null。
indexName - 索引名称indexValues - 索引值RuntimeDaoException - 当数据访问发生错误时抛出java.util.List<B> listOfSelfRef(java.lang.String fkName, java.lang.Object... primaryKeys) throws RuntimeDaoException
primaryKeys ) by the self-reference field specified by fkNamefkName - foreign key nameprimaryKeys - values of primary keysnullRuntimeDaoExceptionjava.util.List<B> listOfSelfRef(java.lang.String fkName, B bean) throws RuntimeDaoException
bean ) by the self-reference field specified by fkNamefkName - foreign key namebean - nullRuntimeDaoExceptionjava.util.List<B> childListOfSelfRef(java.lang.String fkName, B bean) throws java.lang.IllegalStateException, RuntimeDaoException
RuntimeDaoException if self-reference field is cyclefkName - foreign key namebean - java.lang.IllegalStateException - if self-reference field is cycleRuntimeDaoExceptionjava.util.List<B> childListOfSelfRef(java.lang.String fkName, java.lang.Object... primaryKeys) throws java.lang.IllegalStateException, RuntimeDaoException
RuntimeDaoException if self-reference field is cyclefkName - foreign key nameprimaryKeys - values of primary keysjava.lang.IllegalStateException - if self-reference field is cycleRuntimeDaoExceptionjava.util.Set<B> childrenOfSelfRef(java.lang.String fkName, B bean) throws java.lang.IllegalStateException, RuntimeDaoException
RuntimeDaoException if self-reference field is cyclefkName - foreign key namebean - java.lang.IllegalStateException - if self-reference field is cycleRuntimeDaoExceptionjava.util.Set<B> childrenOfSelfRef(java.lang.String fkName, java.lang.Object... primaryKeys) throws java.lang.IllegalStateException, RuntimeDaoException
RuntimeDaoException if self-reference field is cyclefkName - foreign key nameprimaryKeys - values of primary keysjava.lang.IllegalStateException - if self-reference field is cycleRuntimeDaoExceptionjava.util.Set<B> childrenOfBeansOfSelfRef(java.lang.String fkName, java.lang.Iterable<B> beans) throws RuntimeDaoException
RuntimeDaoException if self-reference field is cyclefkName - foreign key namebeans - B beans with primary keysjava.lang.IllegalStateException - if self-reference field is cycleRuntimeDaoException<T> java.util.Set<B> childrenOfPksOfSelfRef(java.lang.String fkName, java.lang.Iterable<T> primaryKeys) throws RuntimeDaoException
RuntimeDaoException if self-reference field is cyclefkName - foreign key nameprimaryKeys - values of primary keysjava.lang.IllegalStateException - if self-reference field is cycleRuntimeDaoExceptionCopyright © 2025. All Rights Reserved.