Class JpaRetrievingOutboundGatewaySpec
java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.springframework.integration.dsl.IntegrationComponentSpec<S,H>
org.springframework.integration.dsl.MessageHandlerSpec<S,JpaOutboundGateway>
org.springframework.integration.jpa.dsl.JpaBaseOutboundEndpointSpec<JpaRetrievingOutboundGatewaySpec>
org.springframework.integration.jpa.dsl.JpaRetrievingOutboundGatewaySpec
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,DisposableBean,FactoryBean<JpaOutboundGateway>,InitializingBean,Lifecycle,Phased,SmartLifecycle,ComponentsRegistration
public class JpaRetrievingOutboundGatewaySpec extends JpaBaseOutboundEndpointSpec<JpaRetrievingOutboundGatewaySpec>
A
JpaBaseOutboundEndpointSpec extension for the
JpaOutboundGateway with
OutboundGatewayType.RETRIEVING mode.- Since:
- 5.0
- Author:
- Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.integration.jpa.dsl.JpaBaseOutboundEndpointSpec
jpaExecutorFields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
PARSER, target -
Constructor Summary
Constructors Modifier Constructor Description protectedJpaRetrievingOutboundGatewaySpec(JpaExecutor jpaExecutor) -
Method Summary
Modifier and Type Method Description JpaRetrievingOutboundGatewaySpecdeleteAfterPoll(boolean deleteAfterPoll)If set totrue, the retrieved objects are deleted from the database upon being polled.JpaRetrievingOutboundGatewaySpecdeleteInBatch(boolean deleteInBatch)If not set, this property defaults tofalse, which means that deletion occurs on a per object basis if a collection of entities is being deleted.JpaRetrievingOutboundGatewaySpecexpectSingleResult(boolean expectSingleResult)This parameter indicates that only one result object shall be returned as a result from the executed JPA operation.JpaRetrievingOutboundGatewaySpecfirstResult(int firstResult)Specify a first result in the query executed.JpaRetrievingOutboundGatewaySpecfirstResultExpression(String firstResultExpression)Specify a SpEL expression that will be evaluated to get the first result in the query executed.JpaRetrievingOutboundGatewaySpecfirstResultExpression(Expression firstResultExpression)Specify a SpEL expression that will be evaluated to get the first result in the query executed.JpaRetrievingOutboundGatewaySpecflushAfterDelete(boolean flush)If set totruetheEntityManager.flush()will be called after persistence operation.JpaRetrievingOutboundGatewaySpecidExpression(String idExpression)Specify a SpEL expression that will be evaluated to get theprimaryKeyforEntityManager.find(Class, Object)JpaRetrievingOutboundGatewaySpecidExpression(Expression idExpression)Specify a SpEL expression that will be evaluated to get theprimaryKeyforEntityManager.find(Class, Object)JpaRetrievingOutboundGatewaySpecmaxResults(int maxResults)Set the maximum number of results expression.JpaRetrievingOutboundGatewaySpecmaxResultsExpression(String maxResultsExpression)Specify a SpEL expression for maximum number of results expression.JpaRetrievingOutboundGatewaySpecmaxResultsExpression(Expression maxResultsExpression)Specify a SpEL expression for maximum number of results expression.Methods inherited from class org.springframework.integration.jpa.dsl.JpaBaseOutboundEndpointSpec
entityClass, getComponentsToRegister, jpaQuery, namedQuery, nativeQuery, parameter, parameter, parameter, parameterExpression, parameterExpression, parameterSourceFactory, usePayloadAsParameterSourceMethods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stopMethods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Constructor Details
-
Method Details
-
expectSingleResult
This parameter indicates that only one result object shall be returned as a result from the executed JPA operation. If set totrueand the result list from the JPA operations contains only 1 element, then that 1 element is extracted and returned as payload.- Parameters:
expectSingleResult- true if a single object is expected.- Returns:
- the spec
-
firstResult
Specify a first result in the query executed.- Parameters:
firstResult- the first result to use.- Returns:
- the spec
-
firstResultExpression
Specify a SpEL expression that will be evaluated to get the first result in the query executed.- Parameters:
firstResultExpression- The first result expression.- Returns:
- the spec
-
firstResultExpression
Specify a SpEL expression that will be evaluated to get the first result in the query executed.- Parameters:
firstResultExpression- The first result expression.- Returns:
- the spec
-
idExpression
Specify a SpEL expression that will be evaluated to get theprimaryKeyforEntityManager.find(Class, Object)- Parameters:
idExpression- the SpEL expression for entityprimaryKey.- Returns:
- the spec
-
idExpression
Specify a SpEL expression that will be evaluated to get theprimaryKeyforEntityManager.find(Class, Object)- Parameters:
idExpression- the SpEL expression for entityprimaryKey.- Returns:
- the spec
-
maxResults
Set the maximum number of results expression. It has be a non null value Not setting one will default to the behavior of fetching all the records- Parameters:
maxResults- the maximum number of results to retrieve- Returns:
- the spec
-
maxResultsExpression
Specify a SpEL expression for maximum number of results expression. Not setting one will default to the behavior of fetching all the records- Parameters:
maxResultsExpression- The maximum results expression.- Returns:
- the spec
-
maxResultsExpression
Specify a SpEL expression for maximum number of results expression. Not setting one will default to the behavior of fetching all the records- Parameters:
maxResultsExpression- The maximum results expression.- Returns:
- the spec
-
deleteAfterPoll
If set totrue, the retrieved objects are deleted from the database upon being polled. May not work in all situations, e.g. for Native SQL Queries.- Parameters:
deleteAfterPoll- defaults tofalse.- Returns:
- the spec
-
deleteInBatch
If not set, this property defaults tofalse, 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."
- Parameters:
deleteInBatch- Defaults to 'false' if not set.- Returns:
- the spec
-
flushAfterDelete
If set totruetheEntityManager.flush()will be called after persistence operation. Has the same effect, if theflushSizeis specified to1. For convenience in cases when the provided entity to persist is not an instance ofIterable.- Parameters:
flush- defaults to 'false'.- Returns:
- the spec
-