类的使用
gu.sql2java.exception.RuntimeDaoException
使用RuntimeDaoException的程序包
-
gu.sql2java中RuntimeDaoException的使用
修饰符和类型方法说明TableManager.addIfAbsent(B bean) If the specified key is not already exist, add it to database.voidListenerContainer.afterDelete(B bean) voidTableListener.Adapter.afterDelete(B bean) voidTableListener.afterDelete(B bean) Invoked just after deleting a B record in the database.voidListenerContainer.afterInsert(B bean) voidTableListener.Adapter.afterInsert(B bean) voidTableListener.afterInsert(B bean) Invoked just after a B record is inserted in the database.voidListenerContainer.afterUpdate(B bean) voidTableListener.Adapter.afterUpdate(B bean) voidTableListener.afterUpdate(B bean) Invoked just after updating a B record in the database.voidListenerContainer.beforeDelete(B bean) voidTableListener.Adapter.beforeDelete(B bean) voidTableListener.beforeDelete(B bean) Invoked just before deleting a B record in the database.voidListenerContainer.beforeInsert(B bean) voidTableListener.Adapter.beforeInsert(B bean) voidTableListener.beforeInsert(B bean) Invoked just before inserting a B record into the database.voidListenerContainer.beforeUpdate(B bean) voidTableListener.Adapter.beforeUpdate(B bean) voidTableListener.beforeUpdate(B bean) Invoked just before updating a B record in the database.TableManager.checkDuplicate(B bean) Check duplicated row by primary keys,if row exists throw exceptionintTableManager.countAll()Retrieves the number of rows of the table.intTableManager.countUsingTemplate(B bean) count the number of elements of a specific beanintTableManager.countUsingTemplate(B bean, int searchType) count the number of elements of a specific bean given the search typeintTableManager.countWhere(String where) Retrieves the number of rows of the table with a 'where' clause.intDelete row according to primary keys of bean.intDelete beans.intTableManager.delete(Collection<B> beans) Delete beans.intTableManager.deleteAll()Deletes all rows from table.intTableManager.deleteByPrimaryKey(Object... keys) Delete row according to its primary keys.intTableManager.deleteByWhere(String where) Deletes rows from the table using a 'where' clause.intTableManager.deleteUsingTemplate(B bean) Deletes rows using a template.voidListenerContainer.done()voidTableListener.Adapter.done()voidTableListener.done()Invoked in finally block, just after insert,update,delete.booleanTableManager.existsByPrimaryKey(B bean) Returns true if this table contains row specified by primary key fields of B.
when you don't know which is primary key of table,you can use the method.booleanTableManager.existsPrimaryKey(Object... keys) Returns true if this table contains row with primary key fields.voidTableManager.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.voidTableManager.foreachByJoinWhere(TableManager.DoEach<B> each, boolean stopOnError, String join, String where) Retrieves each row of B bean given a SQL where clause and a list of fields, and dealt with each action.voidTableManager.foreachByWhere(TableManager.DoEach<B> each, boolean stopOnError, String where) Retrieves each row of B bean given a SQL where clause and a list of fields, and dealt with each action.B[]TableManager.loadAll()Loads all the rows from table.B[]TableManager.loadAll(int startRow, int numRows) Loads the given number of rows from table, given the start row.intTableManager.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.intTableManager.loadAll(TableManager.Action<B> action) Loads each row from table and dealt with action.TableManager.loadAllAsList()Loads all the rows from table.TableManager.loadAllAsList(int startRow, int numRows) Loads the given number of rows from table, given the start row.TableManager.loadByJoinWhereAsList(String join, String where) Retrieves a list of B bean given a sql 'where' clause.TableManager.loadByJoinWhereAsList(String join, 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.TableManager.loadByJoinWhereAsList(String join, String where, Object[] argList, int[] fieldList) Retrieves a list of B bean given a sql where clause, and a list of fields.<T> List<T>TableManager.loadByJoinWhereAsList(String join, String where, Object[] argList, int[] fieldList, int startRow, int numRows, com.google.common.base.Function<B, T> transformer) Retrieves a list of T bean given a sql where clause and a list of fields, and startRow and numRows.intTableManager.loadByJoinWhereForAction(String join, String where, 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 with action.TableManager.loadByPrimaryKey(B bean) Loads a B bean from the table using primary key fields ofbean.TableManager.loadByPrimaryKey(Object... keys) Loads a B bean from the table using primary key fields.TableManager.loadByPrimaryKeyChecked(B bean) TableManager.loadByPrimaryKeyChecked(Object... keys) B[]TableManager.loadByWhere(String where) Retrieves an array of B given a sql 'where' clause.B[]TableManager.loadByWhere(String where, int[] fieldList) Retrieves an array of B bean given a sql where clause, and a list of fields.B[]TableManager.loadByWhere(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.intTableManager.loadByWhere(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.intTableManager.loadByWhere(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.intTableManager.loadByWhere(String where, TableManager.Action<B> action) Retrieves each row of B bean given a sql 'where' clause and dealt with action.TableManager.loadByWhereAsList(String where) Retrieves a list of B bean given a sql 'where' clause.TableManager.loadByWhereAsList(String where, int[] fieldList) Retrieves a list of B bean given a sql where clause, and a list of fields.TableManager.loadByWhereAsList(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.intTableManager.loadByWhereForAction(String where, 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> List<T>TableManager.loadColumnAsList(String column, boolean distinct, String where, int startRow, int numRows) Load column from table.TableManager.loadUniqueUsingTemplate(B bean) Loads a unique B bean from a template one giving a cTableManager.loadUniqueUsingTemplateChecked(B bean) Loads a unique B bean from a template one giving a cB[]TableManager.loadUsingTemplate(B bean) Loads an array of B from a template one.intTableManager.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[]TableManager.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[]TableManager.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.intTableManager.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.intTableManager.loadUsingTemplate(B bean, TableManager.Action<B> action) Loads each row from a template one and dealt with action.TableManager.loadUsingTemplateAsList(B bean) Loads a list of B bean from a template one.TableManager.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.TableManager.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.longSqlRunner.rowCountOf(String sql) compute row count of SQL statementintTableManager.rowCountWhere(String where, Object... argList) Retrieves the number of rows of the table with a 'where' clause.voidSqlRunner.runAsTransaction(Runnable fun) RunRunnableas a transaction.no return<T> TSqlRunner.runAsTransaction(Callable<T> fun) RunCallable<T>as a transaction.
all exceptions butSQLExceptionthrew byCallable<T>is wrapped intoRuntimeException
throwNullPointerExceptioniffunbenull<T> List<T>SqlRunner.runSqlAsList(Class<T> targetType, String sql, Object... argList) Load all the elements using a SQL statement specifying a fields to be retrieved.SqlRunner.runSqlAsList(String sql, Object... argList) Load all the elements using a SQL statement specifying a list of fields to be retrieved.Load all the elements using a SQL statement specifying a list of fields to be retrieved.<T> TSqlRunner.runSqlForValue(Class<T> targetType, String sql, Object... argList) Load all the elements using a SQL statement specifying a row of a field to be retrieved.voidSqlRunner.runWithNoPage(Runnable fun) run aRunnablein Disable PageHelper environment<T> TSqlRunner.runWithNoPage(Callable<T> fun) run aCallable<T>in Disable PageHelper environmentSaves the B bean into the database.B[]Saves an array of B bean into the database.<C extends Collection<B>>
CTableManager.save(C beans) Saves a collection of B bean into the database as transaction.B[]TableManager.saveAsTransaction(B[] beans) Saves an array of B bean into the database as transaction.<C extends Collection<B>>
CTableManager.saveAsTransaction(C beans) Saves a collection of B bean into the database.