public class JpaInboundChannelAdapterSpec extends MessageSourceSpec<JpaInboundChannelAdapterSpec,JpaPollingChannelAdapter> implements ComponentsRegistration
Modifier and Type | Field and Description |
---|---|
protected JpaExecutor |
jpaExecutor |
PARSER, target
logger
DEFAULT_PHASE
OBJECT_TYPE_ATTRIBUTE
Modifier | Constructor and Description |
---|---|
protected |
JpaInboundChannelAdapterSpec(JpaExecutor jpaExecutor) |
Modifier and Type | Method and Description |
---|---|
JpaInboundChannelAdapterSpec |
deleteAfterPoll(boolean deleteAfterPoll)
If set to 'true', the retrieved objects are deleted from the database upon
being polled.
|
JpaInboundChannelAdapterSpec |
deleteInBatch(boolean deleteInBatch)
If not set, this property defaults to
false , which means that
deletion occurs on a per object basis if a collection of entities is being
deleted. |
JpaInboundChannelAdapterSpec |
entityClass(Class<?> entityClass)
Specify the class type which is being used for retrieving entities from the database.
|
JpaInboundChannelAdapterSpec |
expectSingleResult(boolean expectSingleResult)
This parameter indicates that only one result object shall be returned as
a result from the executed JPA operation.
|
JpaInboundChannelAdapterSpec |
flushAfterDelete(boolean flush)
If set to
true the EntityManager.flush() will be called
after persistence operation. |
Map<Object,String> |
getComponentsToRegister() |
JpaInboundChannelAdapterSpec |
jpaQuery(String jpaQuery)
Specify a JPA query to perform persistent operation.
|
JpaInboundChannelAdapterSpec |
maxResults(int maxResults)
Set the maximum number of results expression.
|
JpaInboundChannelAdapterSpec |
maxResultsExpression(Expression maxResultsExpression)
Specify a SpEL expression for maximum number of results expression.
|
JpaInboundChannelAdapterSpec |
maxResultsExpression(String maxResultsExpression)
Specify a SpEL expression for maximum number of results expression.
|
JpaInboundChannelAdapterSpec |
namedQuery(String namedQuery)
Specify a name a named JPQL based query or a native SQL query.
|
JpaInboundChannelAdapterSpec |
nativeQuery(String nativeQuery)
Specify a native SQL query to perform persistent operation.
|
JpaInboundChannelAdapterSpec |
parameterSource(ParameterSource parameterSource)
Specify a
ParameterSource that would be used to provide additional parameters. |
messageHeaders
_this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stop
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
protected final JpaExecutor jpaExecutor
protected JpaInboundChannelAdapterSpec(JpaExecutor jpaExecutor)
public JpaInboundChannelAdapterSpec entityClass(Class<?> entityClass)
entityClass
- the entity Class
to usepublic JpaInboundChannelAdapterSpec jpaQuery(String jpaQuery)
jpaQuery
- the JPA query to use.public JpaInboundChannelAdapterSpec nativeQuery(String nativeQuery)
nativeQuery
- the native SQL query to use.public JpaInboundChannelAdapterSpec namedQuery(String namedQuery)
namedQuery
- the name of the pre-configured query.public JpaInboundChannelAdapterSpec deleteAfterPoll(boolean deleteAfterPoll)
deleteAfterPoll
- Defaults to 'false'.public JpaInboundChannelAdapterSpec deleteInBatch(boolean deleteInBatch)
false
, which means that
deletion occurs on a per object basis if a collection of entities is being
deleted.
If set to 'true' the elements of the payload are deleted as a batch operation. Be aware that this exhibits issues in regards to cascaded deletes.
The specification 'JSR 317: Java Persistence API, Version 2.0' does not support cascaded deletes in batch operations. The specification states in chapter 4.10:
"A delete operation only applies to entities of the specified class and its subclasses. It does not cascade to related entities."
deleteInBatch
- Defaults to 'false' if not set.public JpaInboundChannelAdapterSpec flushAfterDelete(boolean flush)
true
the EntityManager.flush()
will be called
after persistence operation.
Has the same effect, if the flushSize
is specified to 1
.
For convenience in cases when the provided entity to persist is not an instance of Iterable
.flush
- defaults to 'false'.public JpaInboundChannelAdapterSpec parameterSource(ParameterSource parameterSource)
ParameterSource
that would be used to provide additional parameters.parameterSource
- the ParameterSource
to use.public JpaInboundChannelAdapterSpec expectSingleResult(boolean expectSingleResult)
true
and
the result list from the JPA operations contains only 1 element, then that
1 element is extracted and returned as payload.expectSingleResult
- true if a single object is expected.public JpaInboundChannelAdapterSpec maxResults(int maxResults)
maxResults
- the maximum number of results to retrievepublic JpaInboundChannelAdapterSpec maxResultsExpression(String maxResultsExpression)
maxResultsExpression
- The maximum results expression.public JpaInboundChannelAdapterSpec maxResultsExpression(Expression maxResultsExpression)
maxResultsExpression
- The maximum results expression.public Map<Object,String> getComponentsToRegister()
getComponentsToRegister
in interface ComponentsRegistration