The EJB specification states that code executing within a JTA transaction
may not call transaction management methods on transactional resources, like
JDBC connections and JMS sessions. The spec lists specific methods that are
not supported within a JTA transaction:

For JDBC connections:

commit()
rollback()

For JMS sessions:

commit()
rollback()


The list does not include the close() method of jdbc connection ro JMS
sessions. For jdbc connections, there is even an explicit scenario / code
sample where close is called within a JTA traansaction. This is also how I
used to code jdbc with EJBs. Without consulting the spec, I copied this
pattern for JMS sessions. I call close() on the JMS session within a
transactional EJB method.

Some EJB/JMS code written by me, was bundled with a problem report sent to
the support team of an app server vendor. The support engineer returned the
code and told us that one possible reason for the problem was that we (me!)
violated the specification, by calling close() on a JMS session (XASession)
within a JTA transaction.

I spent some time refreshing my mind on the EJB 2.0 spec, the J2EE spec and
the JMS spec. I couldn't realy find a clear answer.

I guess that calling close on managed (enlisted) connections within a JTA
transaction wouldn't be of any particular value to the container. Anyhow -
is it spec complient to call close on a JMS session within a transactional
EJB method?

/Johan

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to