I hooked in JTA on my branch. When KeycloakSessionFactory.create() is
executed this happens:
* the code will check the JTA TransactionManager to see if a transaction
is currently active
* If there is an active transaction, it is suspended
(TransactionManager.suspend()). A new one is created and associated
with the thread TransactionManager.begin()
* A wrapper for the JTA transaction is created and registered with the
KeycloakTransactionManager
* At transaction completion if there was a suspended JTA transaction it
is resumed.
There are some issues with this though. You have to modify the
KeycloakDS <datasource> declaration and put in a flag jta="false". If
you don't do this then you get errors at boot time with Liquibase. So,
that change to KeycloakDS is the actual issue here. Migrating apps will
have to set the jta flag before they will be able to run with the latest
keycloak version. We may be able to specify a warning at boot time.
Bill