Is it possible to use transacted sessions with other Java-technology, transaction processing facilities, for example, JTA?

Jerry Smith

No. It is possible (if provided by the JMS implementation) to use JTA in the context of a session, but not a transacted session. That is, you cannot use Session.commit() and Session.rollback() in a context that's controlled by an instance of UserTransaction.

If, for example, one or more messages, in conjunction with database operations, all form a "logical transactional unit," it's usually best to take advantage of the transaction support provided by the JDBC driver, possibly augmenting this transacted (database) server operation with, javax.transaction.UserTransaction from the Java Transaction API (JTA), if JTA is implemented by the JMS server. Note that JMS implementations vary in their support for distributed tranaction processing. See the javax.jms.XA... interfaces in the API documentation.