And well here is it. But the are more few things to comment about it, for example in the previous post there are not a Transactional capabilities between DB’s because I’m not using JTA transaction type.
Now for this example I write the code to support transactions between multiple data bases with different data sources, like I read on stack overflow:
if you find yourself with multiple entity managers, with corresponding tx managers, then you should consider using a single
JtaTransactionManagerinstead. The entity managers should be able to participate in JTA transactions, and this will give you full transactionality across both entity managers, without having to worry about which entity manager you’re in at any one time.
You can download all code here, it’s hosted on my Github account, pull the code from the branch named “annotations”.
Let’s review the most important files, first the DAO classes: Seguir leyendo