I have to use spring and hibernate to delete two records from two different datasources , but this should be done in single transaction i.e if deletion of one record fails , the other should not be executed or should be rolledback.
Could any one please guide me how this can be achieved?
Standard DataSources and Transaction Managers cannot do this.
You have to use DataSources and Transaction Manager that supports two phase commits. XA Transactions. Such a transaction manager would be a JTA Transaction Manager in an App Server, or a third party tx manager. And the DataSource resource has to be XA compliant.