I have a simple spring boot application that just takes a message from kafka and save to a db2 database:
@Component
@Slf4j
public class KafkaConsumer {
private final PortalONERepository portalONERepository;
private final ObjectMapper objectMapper;
@Autowired
public KafkaConsumer(PortalONERepository portalONERepository, ObjectMapper objectMapper) {
this.portalONERepository = portalONERepository;
this.objectMapper = objectMapper;
}
@KafkaListener(topics = "**")
@Transactional("transactionManager")
public void consumeEventHubMessage(String consumerMessage) {
log.info("Received message from kafka queue: {}", consumerMessage);
//Convert string message to java object
try {
DocumentONE[] documentOne = objectMapper.readValue(consumerMessage, DocumentONE[].class);
//Salvar cada mensagem no db2
portalONERepository.saveAll(Arrays.asList(documentOne));
} catch (JsonProcessingException e) {
log.error("Error receiving message: " + e.getMessage());
}
}
}
But when the application tries to save the object, it throws the following error:
Caused by: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-1667, SQLSTATE=42858, SQLERRMC=D_ODS_STREAM_PORTALONE.TR_RECEP;ORGANIZE BY COLUMN;FINAL|NEW|OLD TABLE, DRIVER=4.31.10
What is could causing the problem ?