public class JdbcAggregateTemplate extends Object implements JdbcAggregateOperations
JdbcAggregateOperations
implementation, storing aggregates in and obtaining them from a JDBC data store.Constructor and Description |
---|
JdbcAggregateTemplate(ApplicationContext publisher,
RelationalMappingContext context,
JdbcConverter converter,
DataAccessStrategy dataAccessStrategy)
Creates a new
JdbcAggregateTemplate given ApplicationContext , RelationalMappingContext and
DataAccessStrategy . |
JdbcAggregateTemplate(ApplicationEventPublisher publisher,
RelationalMappingContext context,
JdbcConverter converter,
DataAccessStrategy dataAccessStrategy)
Creates a new
JdbcAggregateTemplate given ApplicationEventPublisher ,
RelationalMappingContext and DataAccessStrategy . |
Modifier and Type | Method and Description |
---|---|
long |
count(Class<?> domainType)
Counts the number of aggregates of a given type.
|
<S> void |
delete(S aggregateRoot,
Class<S> domainType)
Delete an aggregate identified by it's aggregate root.
|
void |
deleteAll(Class<?> domainType)
Delete all aggregates of a given type.
|
<S> void |
deleteById(Object id,
Class<S> domainType)
Deletes a single Aggregate including all entities contained in that aggregate.
|
<T> boolean |
existsById(Object id,
Class<T> domainType)
Checks if an aggregate identified by type and id exists in the database.
|
<T> Iterable<T> |
findAll(Class<T> domainType)
Load all aggregates of a given type.
|
<T> Page<T> |
findAll(Class<T> domainType,
Pageable pageable)
Load a page of (potentially sorted) aggregates of a given type.
|
<T> Iterable<T> |
findAll(Class<T> domainType,
Sort sort)
Load all aggregates of a given type, sorted.
|
<T> Iterable<T> |
findAllById(Iterable<?> ids,
Class<T> domainType)
Load all aggregates of a given type that are identified by the given ids.
|
<T> T |
findById(Object id,
Class<T> domainType)
Load an aggregate from the database.
|
<T> T |
insert(T instance)
Dedicated insert function to do just the insert of an instance of an aggregate, including all the members of the
aggregate.
|
<T> T |
save(T instance)
Saves an instance of an aggregate, including all the members of the aggregate.
|
void |
setEntityCallbacks(EntityCallbacks entityCallbacks) |
<T> T |
update(T instance)
Dedicated update function to do just an update of an instance of an aggregate, including all the members of the
aggregate.
|
public JdbcAggregateTemplate(ApplicationContext publisher, RelationalMappingContext context, JdbcConverter converter, DataAccessStrategy dataAccessStrategy)
JdbcAggregateTemplate
given ApplicationContext
, RelationalMappingContext
and
DataAccessStrategy
.publisher
- must not be null.context
- must not be null.dataAccessStrategy
- must not be null.public JdbcAggregateTemplate(ApplicationEventPublisher publisher, RelationalMappingContext context, JdbcConverter converter, DataAccessStrategy dataAccessStrategy)
JdbcAggregateTemplate
given ApplicationEventPublisher
,
RelationalMappingContext
and DataAccessStrategy
.publisher
- must not be null.context
- must not be null.dataAccessStrategy
- must not be null.public void setEntityCallbacks(EntityCallbacks entityCallbacks)
entityCallbacks
- public <T> T save(T instance)
JdbcAggregateOperations
save
in interface JdbcAggregateOperations
T
- the type of the aggregate root.instance
- the aggregate root of the aggregate to be saved. Must not be null
.public <T> T insert(T instance)
insert
in interface JdbcAggregateOperations
T
- the type of the aggregate root.instance
- the aggregate root of the aggregate to be inserted. Must not be null
.public <T> T update(T instance)
update
in interface JdbcAggregateOperations
T
- the type of the aggregate root.instance
- the aggregate root of the aggregate to be inserted. Must not be null
.public long count(Class<?> domainType)
JdbcAggregateOperations
count
in interface JdbcAggregateOperations
domainType
- the type of the aggregates to be counted.null
.public <T> T findById(Object id, Class<T> domainType)
JdbcAggregateOperations
findById
in interface JdbcAggregateOperations
T
- the type of the aggregate root.id
- the id of the aggregate to load. Must not be null
.domainType
- the type of the aggregate root. Must not be null
.null
.public <T> boolean existsById(Object id, Class<T> domainType)
JdbcAggregateOperations
existsById
in interface JdbcAggregateOperations
T
- the type of the aggregate root.id
- the id of the aggregate root.domainType
- the type of the aggregate root.public <T> Iterable<T> findAll(Class<T> domainType, Sort sort)
JdbcAggregateOperations
findAll
in interface JdbcAggregateOperations
T
- the type of the aggregate roots. Must not be null
.domainType
- the type of the aggregate roots. Must not be null
.sort
- the sorting information. Must not be null
.null
.public <T> Page<T> findAll(Class<T> domainType, Pageable pageable)
JdbcAggregateOperations
findAll
in interface JdbcAggregateOperations
T
- the type of the aggregate roots. Must not be null
.domainType
- the type of the aggregate roots. Must not be null
.pageable
- the pagination information. Must not be null
.null
.public <T> Iterable<T> findAll(Class<T> domainType)
JdbcAggregateOperations
findAll
in interface JdbcAggregateOperations
T
- the type of the aggregate roots. Must not be null
.domainType
- the type of the aggregate roots. Must not be null
.null
.public <T> Iterable<T> findAllById(Iterable<?> ids, Class<T> domainType)
JdbcAggregateOperations
findAllById
in interface JdbcAggregateOperations
T
- the type of the aggregate roots. Must not be null
.ids
- of the aggregate roots identifying the aggregates to load. Must not be null
.domainType
- the type of the aggregate roots. Must not be null
.null
.public <S> void delete(S aggregateRoot, Class<S> domainType)
JdbcAggregateOperations
delete
in interface JdbcAggregateOperations
S
- the type of the aggregate root.aggregateRoot
- to delete. Must not be null
.domainType
- the type of the aggregate root. Must not be null
.public <S> void deleteById(Object id, Class<S> domainType)
JdbcAggregateOperations
deleteById
in interface JdbcAggregateOperations
S
- the type of the aggregate root.id
- the id of the aggregate root of the aggregate to be deleted. Must not be null
.domainType
- the type of the aggregate root.public void deleteAll(Class<?> domainType)
JdbcAggregateOperations
deleteAll
in interface JdbcAggregateOperations
domainType
- type of the aggregate roots to be deleted. Must not be null
.Copyright © 2017–2020 Pivotal Software, Inc.. All rights reserved.