Page 1 of 1

About Question enthuware.oce-ejbd.v6.2.543 :

Posted: Sun Jan 20, 2013 1:46 pm
by ETS User
Hi,

I think that in the explanation something is missing regarding this:

"If a message-driven bean instance starts a transaction in a message listener method or interceptor method, it must commit the transaction before the message listener method (or all its interceptor methods) returns." - From spec

Since this is the problem right?

Another thing, when I was studying I saw that MDB can have system exceptions and throw EJBExceptions, so I'm a bit confused with this.

Re: About Question enthuware.oce-ejbd.v6.2.543 :

Posted: Sun Jan 20, 2013 3:13 pm
by admin
Yes, that is the problem. In the given code, the bean's onMessage leaves the transaction unfinished i.e. it doesn't commit or rollback the transaction.
As the explanation says, in this situation the container simply rolls back the transaction and discards the bean instance.

It is true that an MDB can throw system exceptions but that is irrelevant to this question. Because this bean doesn't throw any exception.

HTH,
Paul.

Re: About Question enthuware.oce-ejbd.v6.2.543 :

Posted: Sun Jan 20, 2013 5:14 pm
by ETS User
oh ok, I read the spec again and it says: "Log this as an application error to alert the System Administrator". I had the idea that an exception was thrown in this case. But I understood now.

Thanks Paul =)