I am in the middle of an effort to break apart a monolith that uses a single schema. I am trying to prepare to move a subset of tables out of a MySQL schema to a different schema by creating a second JBoss datasource that is still pointing to the same schema but would allow us to change the connection URL to a new schema once the data is migrated. As long as nothing fails, everything works fine, but once there is an error that triggers a rollback, I get hit with the error: Adding multiple last resources is disallowed. Trying to add LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@225ee8cd[connectionListener=3f108d84 connectionManager=2aa20660 warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac120017:-d081b94:67cf0e29:4ac, node_name=1, branch_uid=0:ffffac120017:-d081b94:67cf0e29:4c1, subordinatenodename=null, eis_name=java:/jdbc/mysql/connA > productName=MySQL productVersion=5.7.31-34 jndiName=java:/jdbc/mysql/connA])), but already have LastResourceRecord(XAOnePhaseResource(LocalXAResourceImpl@58e2f322[connectionListener=647117aa connectionManager=4fa9deaa warned=false currentXid=< formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffac120017:-d081b94:67cf0e29:4ac, node_name=1, branch_uid=0:ffffac120017:-d081b94:67cf0e29:4bc, subordinatenodename=null, eis_name=java:/jdbc/mysql/connB > productName=MySQL productVersion=5.7.31-34 jndiName=java:/jdbc/mysql/connB])) You can see that is showing the two datasources but with the same transaction ID. This is my standalone.xml file: <datasources> <datasource jndi-name="java:/jdbc/mysql/connA" pool-name="MySqlDS" enabled="true" use-java-context="false"> <connection-url>${connA.database.url}</connection-url> <driver>mysql-driver</driver> <pool> <min-pool-size>5</min-pool-size> <max-pool-size>${connA.database.max-pool-size:50}</max-pool-size> <prefill>false</prefill> </pool> <security> <user-name>${connA.database.username}</user-name> <password>${connA.database.password}</password> </security> <validation> <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/> <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/> </validation> </datasource> <datasource jndi-name="java:/jdbc/mysql/connB" pool-name="MySqlConnBDS" enabled="true" use-java-context="false"> <connection-url>${connB.database.url}</connection-url> <driver>mysql-driver</driver> <pool> <min-pool-size>5</min-pool-size> <max-pool-size>${connB.database.max-pool-size:50}</max-pool-size> <prefill>false</prefill> </pool> <security> <user-name>${connB.database.username}</user-name> <password>${connB.database.password}</password> </security> <validation> <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/> <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/> </validation> </datasource> ... </datasources> I have two separate HibernateSession providers that use each of these datasources and work just fine as long as there aren't any rollbacks. We want a separate transaction per datasource in the same thread/process because we eventually want to move the subset of tables to a different schema. Is this even possible? I am reading that you cannot have multiple independent transactions on the same thread in JBoss unless you use XA datasources, which I really don't want to do. Could this be fixed if I performed all of the work on ConnB on a different thread? Continue reading...