I have a question about the behavior of transactional() in the following example:
@Bean
IntegrationFlow myFlow(
EntityManagerFactory entityManagerFactory,
TransactionManager transactionManager
) {
return IntegrationFlows.from(MY_CHANNEL)
.routeToRecipients(route -> route
.recipientFlow(flow -> flow
.handle(Jpa.updatingGateway(entityManagerFactory)
.namedQuery(DELETE_EVERYTHING)))
.recipientFlow(flow -> flow
.handle(Jpa.updatingGateway(entityManagerFactory)))
.transactional(transactionManager))
.get();
}
The idea is that I'm first deleting the contents of a database table, and immediately after I'm filling that same table with new data. Will .transactional() in this example make sure that the first step (deletion) is only committed to the DB if the second step (inserting new data) is successful? What part of the documentation can I refer to for this behavior?