We are in the process of upgrading from JBoss 6 to JBoss 7. The nature of our application has a separate database instance per customer, as well as a core configuration data
Two suggestions:
com.arjuna.ats.arjuna.allowMultipleLastResources
to true in the server conf. This will allow the behaviour you want, but unfortunately for the whole app, not just the method. Update:
I don't recommend enabling multiple one-phase resources since it weakens the transactional properties of you app substantially. But if you want to do this in JBoss 7 you need to modify standalone.xml
and add:
<system-properties>
<property name="com.arjuna.ats.arjuna.allowMultipleLastResources" value="true"/>
</system-properties>
You now have a system which is not far away from one without transactions. What it will still do though, is to warn you if you get heuristic outcomes.
My recommendation is still to use XA datasources if you can.
Update 2:
Oh, and if someone comes along to read this I want to add that if you can divide your code into different methods, unlike the OP, I would recommend restructuring your code and use @TransactionAttribute(REQUIRES_NEW)
to create parallel transactions. This is better than turning on multiple 1PC, albeit not as good as turning on XA.
OK, it turns out that unlike JBoss6, a NOT_SUPPORTED transaction is still a transaction as far as the validation logic for retrieving data sources is concerned.
The way to work around this is to make the whole EJB a bean managed transaction:
@TransactionManagement(TransactionManagementType.BEAN)
This unfortunately limits some flexibility in that some times you would rather control this method-by-method, but it isn't too painful a workaround.