Looking at the paging changes in TransactionImpl.
I notice that messages aren't actually paged until commit(), therefore if the transaction is XA and prepare() is called, then the server crashes or is shutdown, the entire transaction is lost, since nothing is recorded until commit! Ouch.
Please add a JIRA for this. It also needs tests. There should be a set of tests that test paging with XA transactions and recovery.
Have you seen BasicXaRecoveryTest::testPagingServerRestarted and testPaging?
Have you also noticed that messages are paged on TransactionImpl::prepare if XA?