ENTITY
- The type whose persistence is managed by this Dao
.PARENT
- The type of the parent (if any) of type ENTITY
.BUILDER
- The type of object that can build an ENTITY
instance.PARENTBUILDER
- The type of the object that can build a PARENT
instance.public class DaoImpl<ENTITY,PARENT,BUILDER,PARENTBUILDER> extends KeylessDaoImpl<ENTITY,PARENT,BUILDER,PARENTBUILDER> implements Dao<ENTITY>, DaoDescriptor<ENTITY,BUILDER>
Dao
implementation.
There is no good reason to directly construct this class yourself.
Use a DaoBuilder
or IndirectDaoBuilder
.
connection, keylessSqlBuilder, sqlRunner
Constructor and Description |
---|
DaoImpl(Connection connection,
DaoDescriptor<ENTITY,BUILDER> daoDescriptor) |
Modifier and Type | Method and Description |
---|---|
void |
atomicDelete(ENTITY item)
Run a delete statement in the database within a transaction.
|
void |
atomicUpdate(ENTITY item)
Run an update statement to change the values in the database associated
with an existing record.
|
List<ChildrenDescriptor<ENTITY,?,BUILDER,?>> |
childrenDescriptors()
The definitions of any entities that are owned by type
ENTITY |
void |
delete(ENTITY item)
Run a delete statement in the database.
|
boolean |
hasParent()
Indicator of whether or not this entity has a parent.
|
Long |
insert(ENTITY item)
Insert a record into the database.
|
protected Envelope<ENTITY> |
newEnvelope(ENTITY item,
long id) |
ParentColumn<ENTITY,PARENT,BUILDER,PARENTBUILDER> |
parentColumn()
The parent column, if there is one, of the
ENTITY . |
PrimaryKey<ENTITY,BUILDER> |
primaryKey()
The primary key for objects of type
ENTITY |
Queries |
queries()
Access the
SQL this Dao is using. |
ENTITY |
select(long id)
Read a record from the database by its primary key.
|
List<ENTITY> |
selectMany(List<Long> ids)
Read several records from the database by their primary keys.
|
void |
update(ENTITY item)
Run an update statement to change the values in the database associated
with an existing record.
|
atomicInsert, buildFunction, foldingSelect, forKeylessDescriptors, fromSingletonList, getColumnCollection, mapBuilders, runBigDecimalFunction, runLongFunction, select, select, selectAll, selectAll, selectByColumns, selectManyByColumns, selectManyByColumns, supplier, tableName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
atomicInsert, foldingSelect, runBigDecimalFunction, runLongFunction, select, select, selectAll, selectAll, selectByColumns, selectManyByColumns, selectManyByColumns
allColumns, buildFunction, dataColumns, getColumnCollection, joinColumns, nonJoinColumns, select, supplier, tableName
public DaoImpl(Connection connection, DaoDescriptor<ENTITY,BUILDER> daoDescriptor)
public boolean hasParent()
DaoDescriptor
hasParent
in interface DaoDescriptor<ENTITY,BUILDER>
public ParentColumn<ENTITY,PARENT,BUILDER,PARENTBUILDER> parentColumn()
DaoDescriptor
ENTITY
.parentColumn
in interface DaoDescriptor<ENTITY,BUILDER>
public List<ChildrenDescriptor<ENTITY,?,BUILDER,?>> childrenDescriptors()
DaoDescriptor
ENTITY
childrenDescriptors
in interface DaoDescriptor<ENTITY,BUILDER>
public Long insert(ENTITY item)
KeylessDao
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.
insert
in interface KeylessDao<ENTITY>
insert
in class KeylessDaoImpl<ENTITY,PARENT,BUILDER,PARENTBUILDER>
item
- The instance to be inserted.public void update(ENTITY item)
Dao
public void delete(ENTITY item)
Dao
public ENTITY select(long id)
Dao
public List<ENTITY> selectMany(List<Long> ids)
Dao
selectMany
in interface Dao<ENTITY>
ids
- The primary keys of the records desired.public void atomicUpdate(ENTITY item)
Dao
Connection
when complete.atomicUpdate
in interface Dao<ENTITY>
item
- An instance of the class with a populated primary key field
and updated field values.public void atomicDelete(ENTITY item)
Dao
Connection
when complete.atomicDelete
in interface Dao<ENTITY>
item
- An instance of type ENTITY with a populated primary key.public PrimaryKey<ENTITY,BUILDER> primaryKey()
DaoDescriptor
ENTITY
primaryKey
in interface DaoDescriptor<ENTITY,BUILDER>
public Queries queries()
Dao
SQL
this Dao
is using.
The SQL
provided is suitable for being passed to a
PreparedStatement
.
protected Envelope<ENTITY> newEnvelope(ENTITY item, long id)
newEnvelope
in class KeylessDaoImpl<ENTITY,PARENT,BUILDER,PARENTBUILDER>
Copyright © 2019. All rights reserved.