Something on the same lines which i am facing difficulties.

I dont know what i am doing wrong or I have understood the concept of
transaction wrongly.
I have a session bean, SB1 which gets invoked by a client, and then it calls
the respective entity beans for inserting data into the corresponding table.
I am testing it, that i am sending one record with the correct data, and the
next child record with a wrong data.
What i am assume by transaction is that if the second one fails then the
first one also should rollback.

In my Entity beans i am using transaction attribute to Required, and in SB1
i am using BMT. I am doing

utx.begin();
utx.commit();

and in the catch statement i am rolling back the transaction. A part of it
works that if an error comes.. It goes in the catch statement, but in the
statement utx.rollback()

i get error that
IllegalStateException the transaction does not exist :(.

I dont know what i am doing wrong..

Could somebody help me out.

TIH,
Vikram.


> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED] Behalf Of Saurabh Sahai
> Sent: Friday, April 04, 2003 5:37 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Transaction issues
>
>
> > I have two session beans, SessionBean1 and SessionBean2.
> > SessionBean1(SB1) is configured with CMT with transaction attribute
> > Required and SessionBean2(SB2) with BMT. So, each business method
> > of SB1 executes with a transaction context.
> > So, my question is, from a business method of SB1, if I call a business
> > method of SB2:
> > * Does the transaction context of SB1 get carried to the business method
> > of SB2?
>
> No. Refer to section 17.6.1 of EJB2.0 specs - it clearly
> indicates that when
> a client (SB1 in your case) invokes a business method on a bean with bean
> managed transaction, the container suspends any transaction that may be
> associated with the client request prior to invoking the bean method.
>
> > * If not, then do I have to call userTransaction.begin() and
> userTransaction.commit() in SB2's business method?
>
> Yes.
>
> > If so, then this seems to negate what  is said in the EJB2.0 spec sec
> 17.1.2(about nested transactions).
>
> No - this is not a case of nested transactions. Nested transactions occur
> when you can start (i.e. nest) a transaction within an existing
> transaction.
> In the scenario described above, you are always dealing with flat
> transactions (as mandated by the current EJB specs) - the
> container suspends
> an existing transaction prior to invoking the method in SB2.
>
> -Saurabh
>
> ==================================================================
> =========
> 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