|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object hirondelle.web4j.database.DbTx
public final class DbTx
Version of Db
for use in a transaction.
The Db
class uses an internal connection to execute single operations.
If more than one operation needs to be performed as an atomic transaction, then
this class is used instead.
This class is identical to Db
, except that it uses a Connection
passed
by the caller.
Method Summary | ||
---|---|---|
static Id |
add(Connection aConnection,
SqlId aSqlId,
Object... aParams)
INSERT operation which returns the database identifier of the added record. |
|
static int |
delete(Connection aConnection,
SqlId aSqlId,
Object... aParams)
DELETE operation which takes parameters. |
|
static int |
edit(Connection aConnection,
SqlId aSqlId,
Object... aParams)
INSERT, UPDATE, or DELETE operations which take parameters. |
|
static
|
fetch(Connection aConnection,
Class<T> aClass,
SqlId aSqlId,
Object... aParams)
SELECT operation which returns a single Model Object. |
|
static
|
fetchCompound(Connection aConnection,
Class<T> aClassParent,
Class<?> aClassChild,
int aNumTrailingColsForChildList,
SqlId aSqlId,
Object... aParams)
SELECT operation which typically returns a single item with a 0..N relation. |
|
static
|
fetchValue(Connection aConnection,
Class<T> aSupportedTargetClass,
SqlId aSqlId,
Object... aParams)
SELECT operation which returns a single 'building block' value such as Integer, BigDecimal, and so on. |
|
static
|
list(Connection aConnection,
Class<T> aClass,
SqlId aSqlId,
Object... aParams)
SELECT operation which returns 0..N Model Objects, one per row. |
|
static
|
listCompound(Connection aConnection,
Class<T> aClassParent,
Class<?> aClassChild,
int aNumTrailingColsForChildList,
SqlId aSqlId,
Object... aParams)
SELECT operation which typically returns mutliple items item with a 0..N relation. |
|
static
|
listRange(Connection aConnection,
Class<T> aClass,
SqlId aSqlId,
Integer aStartIndex,
Integer aPageSize,
Object... aParams)
SELECT operation that returns a List of Model Objects "subsetted" to a particular range of rows. |
|
static
|
listValues(Connection aConnection,
Class<T> aSupportedTargetClass,
SqlId aSqlId,
Object... aParams)
SELECT operation which returns a List of 'building block' values such as Integer, BigDecimal, and so on. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T fetch(Connection aConnection, Class<T> aClass, SqlId aSqlId, Object... aParams) throws DAOException
aConnection
- single connection shared by all operations in the transaction.aClass
- class of the returned Model Object.aSqlId
- identifies the underlying SQL statement.aParams
- parameters for the SQL statement.
DAOException
public static <T> T fetchValue(Connection aConnection, Class<T> aSupportedTargetClass, SqlId aSqlId, Object... aParams) throws DAOException
aConnection
- single connection shared by all operations in the transaction.aSupportedTargetClass
- class supported by the configured
implementation of ConvertColumn
.aSqlId
- identifies the underlying SQL statement.aParams
- parameters for the SQL statement.
DAOException
public static <T> List<T> list(Connection aConnection, Class<T> aClass, SqlId aSqlId, Object... aParams) throws DAOException
aConnection
- single connection shared by all operations in the transaction.aClass
- class of the returned Model Objects.aSqlId
- identifies the underlying SQL statement.aParams
- parameters for the SQL statement.
List
of Model Objects. The list may be empty.
DAOException
public static <T> List<T> listValues(Connection aConnection, Class<T> aSupportedTargetClass, SqlId aSqlId, Object... aParams) throws DAOException
aConnection
- single connection shared by all operations in the transaction.aSupportedTargetClass
- class supported by the configured
implementation of ConvertColumn
.aSqlId
- identifies the underlying SQL statement.aParams
- parameters for the SQL statement.
List
of building block objects. The list may be empty.
DAOException
public static <T> List<T> listRange(Connection aConnection, Class<T> aClass, SqlId aSqlId, Integer aStartIndex, Integer aPageSize, Object... aParams) throws DAOException
This method is intended for paging through long listings. When the underlying SELECT returns many pages of items, the records can be "subsetted" by calling this method.
See Pager
.
aConnection
- single connection shared by all operations in the transaction.aClass
- class of the returned Model Objects.aSqlId
- identifies the underlying SQL statement.aStartIndex
- 1-based index indentifying the first row to be returned.aPageSize
- number of records to be returned.aParams
- parameters for the SQL statement.
List
of Model Objects. The list may be empty.
DAOException
public static int edit(Connection aConnection, SqlId aSqlId, Object... aParams) throws DAOException, DuplicateException
aConnection
- single connection shared by all operations in the transaction.aSqlId
- identifies the underlying SQL statement.aParams
- parameters for the SQL statement.
DAOException
DuplicateException
public static Id add(Connection aConnection, SqlId aSqlId, Object... aParams) throws DAOException, DuplicateException
This operation is not supported by all databases. See
Statement
for more information.
aConnection
- single connection shared by all operations in the transaction.aSqlId
- identifies the underlying SQL statement.aParams
- parameters for the SQL statement.
DAOException
DuplicateException
public static int delete(Connection aConnection, SqlId aSqlId, Object... aParams) throws DAOException
aConnection
- single connection shared by all operations in the transaction.aSqlId
- identifies the underlying SQL statement.aParams
- identifies the item to be deleted. Often 1 or more Id
objects.
DAOException
public static <T> T fetchCompound(Connection aConnection, Class<T> aClassParent, Class<?> aClassChild, int aNumTrailingColsForChildList, SqlId aSqlId, Object... aParams) throws DAOException
The ResultSet is parsed into a single parent Model Object having a List of 0..N child Model Objects. See note on compound objects for more information.
aConnection
- single connection shared by all operations in the transaction.aClassParent
- class of the parent Model Object.aClassChild
- class of the child Model Object.aNumTrailingColsForChildList
- number of columns appearing at the end of the ResultSet which
are passed to the child constructor.aSqlId
- identifies the underlying SQL statement.aParams
- parameters to the underlying SQL statement.
DAOException
public static <T> List<T> listCompound(Connection aConnection, Class<T> aClassParent, Class<?> aClassChild, int aNumTrailingColsForChildList, SqlId aSqlId, Object... aParams) throws DAOException
The ResultSet is parsed into a List of parent Model Objects, each having 0..N child Model Objects. See note on compound objects for more information.
aConnection
- single connection shared by all operations in the transaction.aClassParent
- class of the parent Model Object.aClassChild
- class of the child Model Object.aNumTrailingColsForChildList
- number of columns appearing at the end of the ResultSet which
are passed to the child constructor.aSqlId
- identifies the underlying SQL statement.aParams
- parameters to the underlying SQL statement.
DAOException
|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |