Version 2

    I get the message "Prepare called on a local tx. Use of local transactions on a jta transaction with more than one branch may result in inconsistent data in some cases of failure." what does it mean?


    Your jdbc datasource does not support two phase commit, it does not support XA.


    The following could occur during the commit:

    JMS: prepare (vote ok)
    JDBC: prepare (there is no prepare since it is not XA)
    JMS: commit (guaranteed to work since it was prepared ok)
    JDBC: commit (might fail)


    This is bad, the JMS branch of the commit worked but the database commit failed.


    Last Resource Gambit

    JBoss-4.0.0DR3 has an implementation of the Last Resource Gambit this reorders the local resource to make it compatible with XA Code:

    JMS: prepare (vote ok)
    JDBC: commit 
    -> fails, rollback JMS
    -> suceeds, commit JMS


    This works with any number of XA resources, but only one local resource is allowed.