hi sam,
you can just pass the (same) connection object to
the method(s) you call. it is quite mandatory
that for updates(whether its an insert/select/update/delete)
to be the transaction aware (the possibility to rollback
or commit), you need to use the same connection.
you do need to release the connection object at
the end i.e. do not hold on to it. simply let the connection
object go out of scope at the end of the method call.
cmp does the same i.e. for every transaction started
by the container a (new) connection is obtained from the
connection pool. this connection is used by all
beans participating in the transaction and at the end
the connection object is released and goes back to
the pool.
hope this helps and of course someone will correct
me if i'm wrong. :)
-krish
----- Original Message -----
From: Geert Mergan <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 23, 2001 11:14 AM
Subject: Re: Relation between Transaction and Connection
> Let me first rephrase your question to see whether we're talking about the
> same thing..
>
> At the beginning of each method that parcipates in the transaction I
request
> a connection from the connection pool and at the end of each method that
> participates in the transaction I return that connection to the connection
> pool... The only way to ensure transactional integrity is if all methods
use
> the same connection... Now how I can be sure that all methods
participating
> in my transaction use the same connection and is that connection
> transactional?
>
> Well the answer can be very short: the intelligence to achieve this is
> somewhere in the ejbcontainer. You should be able to test this by writing
a
> example were you compare the connection object used by the various methods
> in your transaction.
>
> Hope that helps,
>
>
>
> Geert
>
> > -----Original Message-----
> > From: A mailing list for Enterprise JavaBeans development
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Samuel Abraham
> > Sent: Thursday, March 22, 2001 9:18 AM
> > To: [EMAIL PROTECTED]
> > Subject: Relation between Transaction and Connection
> >
> >
> > hi,
> > Is there any association between a transaction and the
> > connection used for
> > the transaction?
> > For example:
> > I have a Session bean with a method which is having TX_REQUIRED as
> > attribute.
> > In the method different classes(normal classes not Entity
> > beans) modelling
> > tables are used for INSERT/UPDATE etc.
> > Lets assume that all these classes create a new connection
> > and do the work.
> > Now if an operation in one of these classes fail will the
> > whole operation in
> > the Session bean method rollback?
> > TIA
> > sam
>
>
===========================================================================
> 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".