ENTITY
- The type of the data to be persisted.public interface KeylessDao<ENTITY>
KeylessDao
is an interface that allows basic, non-singular CRUD operations to be performed.
Using a KeylessDao
, you can insert, records individually, but select, update, and delete all are limited
to multi-row operations, as there is no Primary Key defined.Modifier and Type | Method and Description |
---|---|
Long |
atomicInsert(ENTITY item)
Insert a record into the database within a transaction that is
managed within the Dao.
|
<T> T |
foldingSelect(T identity,
BiFunction<T,ENTITY,T> accumulator,
Where where)
Computes a result based on the entities found by a select statement
without realizing the entire list of found entities in memory.
|
Long |
insert(ENTITY item)
Insert a record into the database.
|
BigDecimal |
runBigDecimalFunction(SqlFunction function,
String columnName,
Where where)
Computes an aggregated BigDecimal value, based on the select criteria specified
and the given SqlFunction and column name.
|
Long |
runLongFunction(SqlFunction function,
String columnName,
Where where)
Computes an aggregated Long value, based on the select criteria specified
and the given SqlFunction and column name.
|
List<ENTITY> |
select(Where where)
Run a select in the data store for entities matching the given where predicates.
|
List<ENTITY> |
select(Where where,
Order order)
Run a select in the data store for entities matching the given where predicates
returned in the order specified.
|
List<ENTITY> |
selectAll()
Read all the records in the database of type ENTITY.
|
List<ENTITY> |
selectAll(Order order)
Read all the records in the database of type ENTITY in the
required order.
|
ENTITY |
selectByColumns(ENTITY item,
String... columnNames)
Select a single record from the database by some search criteria.
|
List<ENTITY> |
selectManyByColumns(ENTITY template,
Order order,
String... columnNames)
Select multiple records from the database by some search criteria in the
required order.
|
List<ENTITY> |
selectManyByColumns(ENTITY template,
String... columnNames)
Select multiple records from the database by some search criteria.
|
Long insert(ENTITY item)
Depending on how the Dao was constucted (whether from a regular
DaoBuilder
or an IndirectDaoBuilder
)
a particular instance of this class may or may not attempt
to mutate the state of the passed item by setting its primary
key.
item
- The instance to be inserted.List<ENTITY> selectAll()
No laziness or caching is involved here. This simply tries to instantiate all the records it can based on the full table.
List<ENTITY> selectAll(Order order)
No laziness or caching is involved here. This simply tries to instantiate all the records it can based on the full table.
order
- The ordering to useList<ENTITY> selectManyByColumns(ENTITY template, String... columnNames)
The SQL generated will specify a select by the column names passed, where the values are equal to the values specified in the passed template object. All the values must match, as the where clause will be formed by joining the various column names with 'AND'.
template
- An instance of type ENTITY with populated values corresponding to the
column names to select by.columnNames
- The names of the database columnsList<ENTITY> selectManyByColumns(ENTITY template, Order order, String... columnNames)
The SQL generated will specify a select by the column names passed, where the values are equal to the values specified in the passed template object. All the values must match, as the where clause will be formed by joining the various column names with 'AND'.
template
- An instance of type ENTITY with populated values corresponding to the
column names to select by.order
- The ordering to usecolumnNames
- The names of the database columnsENTITY selectByColumns(ENTITY item, String... columnNames)
item
- An instance of type ENTITY with populated values corresponding to the
column names to select by.columnNames
- The names of the database columnsList<ENTITY> select(Where where)
where
- The predicates to drive selection.List<ENTITY> select(Where where, Order order)
where
- The predicates to drive selection.order
- The ordering to useLong atomicInsert(ENTITY item)
Connection
when complete.item
- The instance to be inserted.<T> T foldingSelect(T identity, BiFunction<T,ENTITY,T> accumulator, Where where)
T
- The type of the value to be computed.identity
- The identity element of the return type.accumulator
- A function that computes the desired value based on
the values seen thus far and the next instance
of the entity found in the result set.where
- Predicates to drive selection of resultsLong runLongFunction(SqlFunction function, String columnName, Where where)
Will run SQL that looks like this:
select FUNCTION(COLUMN) from TABLE where ...
function
- The function to runcolumnName
- The column to apply the function towhere
- Predicates to drive selection of resultsBigDecimal runBigDecimalFunction(SqlFunction function, String columnName, Where where)
Will run SQL that looks like this:
select FUNCTION(COLUMN) from TABLE where ...
function
- The function to runcolumnName
- The column to apply the function towhere
- Predicates to drive selection of resultsCopyright © 2019. All rights reserved.