I am currently developing an application based on the Spring Boot framework that is employing a JPA inbound channel adapter to retrieve data from a relational database. I have a stored procedure named GetEmployee which needs to accept a value that varies based on the server instance on which the application is running.
I've looked at the Spring documentation on adapters, and it makes mention of a tag named int-jpa:parameter but that appears to only be utilized when the named-query attribute is utilized instead of the native-query attribute.
There is also a parameter-source attribute on the int-jpa:inbound-channel-adapter tag, but I haven't found any good documentation on how to utilize it.
Is there a way to pass a parameter from a Spring bean to the native query? Or is the better approach to use the named-query attribute?
Configuration XML:
<int-jpa:inbound-channel-adapter
id="employeeAdapter"
channel="employeeChannel"
entity-manager-factory="entityManagerFactory"
entity-class="com.example.entities.Employee"
native-query="EXEC emp.dbo.GetEmployee"
expect-single-result="false"
delete-after-poll="false">
<int:poller fixed-rate="10000">
<int:transactional propagation="REQUIRED" isolation="DEFAULT"
transaction-manager="transactionManager" />
</int:poller>
</int-jpa:inbound-channel-adapter>