Ok i have tried to put together a quick design solution. See image below
The problem i think i am having is how to commit. Here is the flow of processing
- InvoiceBD gets an Oracle connection from the factory class and calls InvoiceUploadDAO.readData passing it the Oracle connection object.
- InvoiceBD get a SQL Server connection from the factory class and calls InvoiceUploadDAO.writeData passing it the SQL Server connection object.
- InvoiceBD reuses the Oracle connection to call InvoiceUploadDAO.update status to 'Complete' set status on the Oracle database.
InvoiceBD commits the Oracle connection.
InvoiceBD commits the SQL Server connection.
Or if something goes wrong both connection objects are rolled back.
Does that sound like a possible approach? I cant seem to workout how to resolve a situation where the first commit succeeds but the second fails.
Thanks