T
- The item whose persistence is managed by this Dao
public class DaoImpl<T> extends Object implements Dao<T>, DaoDescriptor<T>
Dao
implementation.
There is no good reason to directly construct this class yourself.
Use a DaoBuilder
.
Constructor and Description |
---|
DaoImpl(Connection connection,
String tableName,
Supplier<T> supplier,
PrimaryKey<T> primaryKey,
List<TypedColumn<T>> dataColumns,
List<JoinColumn<T,?>> joinColumns,
List<ChildrenDescriptor<T,?>> childrenDescriptors) |
Modifier and Type | Method and Description |
---|---|
List<ChildrenDescriptor<T,?>> |
childrenDescriptors() |
List<TypedColumn<T>> |
dataColumns() |
void |
delete(T item)
Run a delete statement in the database.
|
String |
deleteSql(T item) |
long |
insert(T item)
Insert a record into the database.
|
List<JoinColumn<T,?>> |
joinColumns() |
PrimaryKey<T> |
primaryKey() |
T |
select(long id)
Read a record from the database.
|
List<T> |
selectAll()
Read all the records in the database of type T.
|
T |
selectByColumns(T item,
String... columnNames)
Select a single record from the database by some search criteria.
|
List<T> |
selectMany(List<Long> ids)
Read several records from the database.
|
List<T> |
selectManyByColumns(T item,
String... columnNames)
Select multiple records from the database by some search criteria.
|
Supplier<T> |
supplier() |
String |
tableName() |
void |
update(T item)
Run an update statement to change the values in the database associated
with an existing record.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
allColumns, columnMap
public DaoImpl(Connection connection, String tableName, Supplier<T> supplier, PrimaryKey<T> primaryKey, List<TypedColumn<T>> dataColumns, List<JoinColumn<T,?>> joinColumns, List<ChildrenDescriptor<T,?>> childrenDescriptors)
public String tableName()
tableName
in interface DaoDescriptor<T>
public List<TypedColumn<T>> dataColumns()
dataColumns
in interface DaoDescriptor<T>
public List<JoinColumn<T,?>> joinColumns()
joinColumns
in interface DaoDescriptor<T>
public Supplier<T> supplier()
supplier
in interface DaoDescriptor<T>
public PrimaryKey<T> primaryKey()
primaryKey
in interface DaoDescriptor<T>
public List<ChildrenDescriptor<T,?>> childrenDescriptors()
childrenDescriptors
in interface DaoDescriptor<T>
public long insert(T item)
Dao
public void update(T item)
Dao
public void delete(T item)
Dao
public T select(long id)
Dao
public List<T> selectMany(List<Long> ids)
Dao
selectMany
in interface Dao<T>
ids
- The primary keys of the records desired.public List<T> selectAll()
Dao
public T selectByColumns(T item, String... columnNames)
Dao
selectByColumns
in interface Dao<T>
item
- An instance of type T with populated values corresponding to the
column names to select by.columnNames
- The names of the database columnspublic List<T> selectManyByColumns(T item, String... columnNames)
Dao
selectManyByColumns
in interface Dao<T>
item
- An instance of type T with populated values corresponding to the
column names to select by.columnNames
- The names of the database columnsCopyright © 2018. All rights reserved.