I have a requirement where i have to read from a file and insert them to a table after processing the read records. Also at the same time it has to delete from another table.
The deletion should happen only after the first transaction is successful, however any problem in the deletion should not cause a rollback of the prior i inserted record.
What would be the best way to achieve this? Currently i want to plugin the delete logic in the same itemwriter which inserts the records and spawn a new transaction for delete. But this approach seems to have some issues. Would CompositeItemWriter be another solution?
Thanks in advance.