public abstract class AbstractDataAccessObject extends Object implements DataAccessObject
Helper class to make it easier to create DAOs. This base class implements several of the DAO convenience methods in terms of the master DataAccessObject.streamEntities(EntityQuery)
method, so that DAO implementers only need to translate EntityQuery
objects into their underlying query framework (collection predicates, Jooq queries, HQL, or whatever).
Constructor and Description |
---|
AbstractDataAccessObject() |
Modifier and Type | Method and Description |
---|---|
<V extends Entity> |
query(Class<V> type)
Start a query for a particular type using the fluent query interface.
|
Query<Entity> |
query(EntityType type)
Start a query using the fluent query interface.
|
ObjectStream<Entity> |
streamEntities(EntityType type)
Stream all entities of a particular type.
|
<E extends Entity> |
streamEntityGroups(EntityQuery<E> query,
TypedName<Long> grpCol)
Stream entities in response to a query, grouping them by a long ID.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEntityIds, getEntityTypes, lookupEntity, lookupEntity, streamEntities
public Query<Entity> query(EntityType type)
DataAccessObject
Start a query using the fluent query interface.
query
in interface DataAccessObject
type
- The type of entity to retrieve.public <V extends Entity> Query<V> query(Class<V> type)
Start a query for a particular type using the fluent query interface. This method looks up the entity type using the DefaultEntityType
annotation on the view class.
This implementation uses an internal Query
implementation to prepare queries for DataAccessObject.streamEntities(EntityQuery)
and streamEntityGroups(EntityQuery, TypedName)
.
query
in interface DataAccessObject
type
- The view class type.public ObjectStream<Entity> streamEntities(EntityType type)
Stream all entities of a particular type.
This implementation delegates to DataAccessObject.streamEntities(EntityQuery)
streamEntities
in interface DataAccessObject
type
- The entity type.public <E extends Entity> ObjectStream<IdBox<List<E>>> streamEntityGroups(EntityQuery<E> query, TypedName<Long> grpCol)
Stream entities in response to a query, grouping them by a long ID.
This implementation delegates to streamEntities(EntityType)
and groups the result.
streamEntityGroups
in interface DataAccessObject
query
- The query.grpCol
- The column to group by.