Q:

can user transaction take control over local transaction

I have to write  code that is using third party code (can't change code).
In my code I want to use JTA (on JBoss) in order to enforce all or nothing for all the operations in my code (method). One of these operations is a call to  the third party API that is doing the actual save/update operation to DB with local transaction and with its own sql connection.After I have other operations like writing to output stream and more , but I want to be able to rollback the DB operation (of third party API) if not all of after operations is done.
Can I do this ? I mean can my user transaction take control over the third party local transaction ?

A:

Inside the JTA scope I will call the third party API that is doing the actual save/update operation to DB with local transaction and with its own sql connection. Can I do this ?

I think it's possible but if it's the same database and same tables which are used in both cases, you could have need to refresh data in the JTA transaction.

I mean can my user transaction can take control over the third party local transaction ?

It depends on if your third party code creates mandatory its own transaction (begin and commit).
If it's the case, JTA cannot take control over the third party transaction because the spec doesn't allow to do it.

However, the Java EE transaction manager does have one limitation: It does not support nested transactions. In other words, it cannot start a transaction for an instance until the preceding transaction has ended.
  https://docs.oracle.com/cd/E19798-01/821-1841/bnciz/index.html

