I'll assume that you are triggering a CreateException.

Rollback does not automatically occur because of an application-level exception.
CreateException happens to be an application-level exception. If you want a
rollback to occur on a CreateException, you will have to explicitly mark it for
rollback. Typically this is not done in the entity, but rather in the session
wrapper. There is a table in section 12.3.1 (EJB 1.1 Final) that indicates when
an application exception causes a rollback.

I can't explain why you see a message that says "Transaction rolled back.".

Also, your marking of entity methods as Supports (or Never or NotSupported) may
cause problems in some containers. Entity beans should always be marked as
Required, RequiresNew, or Mandatory. The 2.0 spec tightens up on this as well.
See 16.7.5 "Handling of methods that run with "an unspecified transaction
context" (EJB 2.0 PD).

jim

----- Original Message -----
From: "Shiv Kumar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 01, 2000 2:58 AM
Subject: Re: Transaction Problem


> Hi
>
> I am using CMP entity beans in the same scenario, same tx attribute settings
> etc. But even then the Rollback does not happen. Any ideas?
>
> Regards.
> --
> shiv
> [EMAIL PROTECTED]
>
> Virgil Lee wrote:
>
> > Hi,
> >
> > I have a session bean function that calling three entity beans as a unit of
> > work.
> > The function simply calls the entity beans' create function one by one.
> > Suppose when calling the third one it throws an exception, that case the
> > whole transaction should be rolled back.
> > I got the remote exception from the client calling the session bean
> > function:
> > Transaction was rolled back: javax.ejb.EJBException; nested exception is:
> > javax.ejb.EJBException
> >
> > which is normal I suppose.  But the fact is when I check back the database,
> > nothing was rolled back, the newly inserted records for the first two entity
> > beans are there.
> >
> > The transaction type is container and I've set the session bean's
> > trans-attribute as Required and others as Supports.
> > I'm using BMP, and every call to the database I need to make a connection
> > and close it afterward.  It seems to me that when the connection has been
> > closed, it commits everything and the container cannot roll anything back.
> >
> > I'm struggling on this for a period of time already, any clues or help are
> > much appreciated.
>
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
>
> ===========================================================================
> 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".
>
>

===========================================================================
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