Page 1 of 1

createSession arguments are ignored in EJB 3.1

Posted: Sun Dec 02, 2012 4:04 pm
by zfvit
Since createSession are ignored in EJB 3.1, I think that the "right" answer (When you create a session, you specify whether it is transacted.) is wrong.

From the spec:

"
Because the container manages the transactional enlistment of JMS sessions on behalf of a bean, the parameters of the createSession(boolean transacted, int acknowledgeMode), createQueueSession(boolean transacted, int acknowledgeMode) and createTopicSession(boolean transacted, int acknowledgeMode) methods are ignored. It is recommended that the Bean Provider specify that a session is transacted, but provide 0 for the value of the acknowledgment mode.
"

Re: createSession arguments are ignored in EJB 3.1

Posted: Sun Dec 02, 2012 6:23 pm
by admin
zfvit, What you've quoted ( Section 13.3.5 ) is applicable only for CMT beans. Since the container manages transactions for a CMT bean the parameters don't make sense. But they do make sense for BMT beans. So in a situation where you are in fact able to control the transactions, you need to use the session and not the connection. That is why this option is marked correct.

HTH,
Paul.