Spring integration jpa入站通道适配器没有';t支持参数源
我试图使用参数源在入站通道适配器中为我的查询提供一个参数,但它似乎不起作用。我已经浏览了解析器代码,我认为它没有处理参数源Spring integration jpa入站通道适配器没有';t支持参数源,spring-integration,Spring Integration,我试图使用参数源在入站通道适配器中为我的查询提供一个参数,但它似乎不起作用。我已经浏览了解析器代码,我认为它没有处理参数源 <int-jpa:inbound-channel-adapter delete-after-poll="true" delete-in-batch="true" auto-startup="true" flush-after-delete="true" max-results="2000" entity-manager-factory="ent
<int-jpa:inbound-channel-adapter delete-after-poll="true"
delete-in-batch="true" auto-startup="true" flush-after-delete="true"
max-results="2000"
entity-manager-factory="entityManagerFactory"
entity-class="AuditMessage"
channel="processMessage"
jpa-query="select a from AuditMessage a where a.updateTs < :purgeDate"
parameter-source="parameterSource">
<int:poller cron="*/5 * * * * *" >
<int:transactional transaction-manager="transactionManager"/>
</int:poller>
</int-jpa:inbound-channel-adapter>
<bean id="parameterSource" factory-bean="spelSource"
factory-method="createParameterSourceNoCache">
<constructor-arg value="" />
</bean>
<bean id="spelSource"
class="org.springframework.integration.jdbc.ExpressionEvaluatingSqlParameterSourceFactory">
<property name="parameterExpressions">
<map>
<entry key="purgeDate"
value="new java.sql.Timestamp(T(System).currentTimeMillis()-(T(java.util.concurrent.TimeUnit).MILLISECONDS.convert(${eam.integration.arcgis.purge.daysToKeep}, T(java.util.concurrent.TimeUnit).DAYS)))" />
</map>
</property>
</bean>
我使用的是spring版本4.0.3。我做错什么了吗?还是有其他方法提供查询参数?我想您刚刚发现了一个bug
JpaInboundChannelAdapterParser
只是不解析参数源
属性。请随意提出错误
作为一种解决方法,您必须将JpaPollingChannelAdapter
配置为原始
,注入JpaExecutor
,并将其用作通用
中的ref
JIRA适用于那些想要追踪的人。感谢您的快速回答和添加JIRA票证。
ERROR [task-scheduler-9] [java.lang.IllegalArgumentException: Query has parameters but no parameter source provided
at org.springframework.integration.jpa.core.DefaultJpaOperations.setParametersIfRequired(DefaultJpaOperations.java:330)
at org.springframework.integration.jpa.core.DefaultJpaOperations.getQuery(DefaultJpaOperations.java:114)
at org.springframework.integration.jpa.core.DefaultJpaOperations.getResultListForQuery(DefaultJpaOperations.java:186)
at org.springframework.integration.jpa.core.JpaExecutor.doPoll(JpaExecutor.java:396)...