posted 20 years ago
I believe there are 2 separate issues:
1. Message acknowledgement
2. Transaction management
For issue 1, if I understand the spec correctly [pg 316-317], for BMT beans the message acknowledgement is not part of the transaction. The EJB spec doesn't say when the ACK happens, but from the JMS spec I'd suspect it happens as soon as you return from onMessage. How or when you commit isn't relevant.
As for the second part, if you return from a method without committing the transaction, then your BMT MDB code is just plain broken. The spec doesn't say you can't write broken code, but obviously you can't expect good things to happen. There is no association between client and MDB onMessage transactions, so nobody else will have an opportunity to commit the transaction. Effectively you'll have a resource leak and eventually the server might crash.
Reid - SCJP2 (April 2002)