Please see tests in org.hibernate.test.tm package for ideas about testing your scenario.
You can also look for instances in the tests that use org.hibernate.testing.jta.TestingJtaPlatformImpl.