@Bean
public JpaPollingChannelAdapter reimStgResponseJpaInboundAdapter() {
return Jpa
.inboundAdapter(entityManager)
.nativeQuery(responseQueryString)
//.expectSingleResult(true)
.get();
}
@Bean
public IntegrationFlow reimFeedbackHandle() {
return IntegrationFlows
.from("reimFeedbackChannel")
.handle(msg -> {
try {
dctmHandler.handleReIMFeedback(msg);
} catch (Exception e) {
e.printStackTrace();
}})
.get();
}
the .expectSingleResult(true)
return exception that 1 result was expected.
The native query is String responseQueryString = "select * from RMS16DEV.TSC_IM_DOC_HEAD_TEMP where error_ind is not null"
;
The msg from inbound adapter is an array list and I am not able to cast it to the correct entity. What is the type that is returned by jpa inbound adapter to the channel?
public void handleReIMFeedback(Message<?> reimStgRowMsg) throws Exception {
List<TSC_IM_DOC_HEAD_TEMP> list = (List<TSC_IM_DOC_HEAD_TEMP>) reimStgRowMsg.getPayload();
System.out.println( (list.get(0)));
}
gives me:
java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class java.util.List ([Ljava.lang.Object; and java.util.List are in module java.base of loader 'bootstrap')
at tesco.finance.gss.dctmreim.jpa.handlers.DctmHandlers.handleReIMFeedback(DctmHandlers.java:28)
`