Dan Christopherson (danch)
STR Technical Architect (www.str.com)
On Mon, 24 Jul 2000, Ole Husgaard wrote:
> Stephan Gruschke wrote:
> >
> > Hello Rickard,
> >
> > Monday, July 24, 2000, 3:26:57 PM, you wrote:
> >
> > R�> Hi!
> >
> > R�> Stephan Gruschke wrote:
> > >> Oh, yeap. The problem is that if an exception occurs in an bmp entity
> > >> bean, an InvocationTargetException is thrown. The exception is an
> > >> wrapper for the real exception thrown by the bean. What should be the
> > >> preferred way: Wrap the returned bean exception in an create exception
> > >> or return the real exception?
> >
> > R�> As it says in the EJB spec is the preferred way ;-) (i.e. go look it up)
> > Well the ejb spec states that the original exception should be thrown.
> > That's clear.
>
> Almost. The exact behavior is specified in EJB spec. section 12.3.1.
> If the container just started a transaction on the home.create() call
> (RequiresNew attribute, for example), it should try to commit the
> transaction before throwing the application exception (unless
> setRollbackOnly() was called in which case the transaction must be
> rolled back).
The default behavior being a commit is a little surprising to me: if I
throw an exception, it seems to strongly imply that what I was trying
didn't work and I probably want to roll it back. Can anyone shed light on
this for me?
<snip!>