Yes, bean-managed/container-managed transaction demarcation is different
from BMP/CMP.
In Section 11.3.3 of the 1.1 specification, the spec says the
UserTransaction interface should be used to demarcate transactions ("The
Bean Provider uses the UserTransaction interface to demarcate
transactions."), and that commmit() or rollback() should not be called on
the Connection interface ***within*** a transaction. Are you interpretting
this to mean that the Connection interface can be used to demarcate
transactions, as long as you are not also using the UserTransaction
interface?
Laurel
-----Original Message-----
From: David Bullock [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 16, 2001 9:31 AM
To: Laurel Neustadter
Cc: [EMAIL PROTECTED]
Subject: Re: Is it mandatory to have XADataSource for EJB transactional
suport
Yes, quickly:
1. EJB supports both 'bean managed' and 'container managed' transactions. (
note: this is not the same thing as 'BMP/CMP *persistence*' ).
2. To support 'bean managed', is *is* legal to make calls on the
java.jdbc.Connection, if the deployment descriptor declares that your EJB is
bean-managed.
3. To support 'container managed' it is *illegal* to make calls on the
java.jdbc.Connection, if the deployment descriptor delcares that your EJB is
container-managed.
Things to note:
a. when you do 'bean managed persistence', you can only manage the
transaction from a session bean - this is the appropriate way to begin a
transaction that spans multiple entity beans
b. when your entity beans ask for a JDBC Connection as per your
java:comp/env/myDriverJNDILocation, the container will give you back the
same physical connection that you initialised from your SessionBean.
Note also that, in keeping with the idea of a transaction, most containers
will disallow you to do 'transaction sensitive' operations when CMT is being
used ... it is the container's job to specify the transaction isolation and
do the commits. As well, when using BMT, you will want to basically start
the transaction and commit/rollback at the start and end of the work you
have to do.
Hope that clears it up.
cheers,
David.
On Wed, 16 May 2001, Laurel Neustadter wrote:
> Can anyone explain the underlying technical reasons why EJB does not
permit
> transactions to be demarcated via java.sql.Connection? I know the "what",
> but don't have a full understanding of the "why".
>
> Laurel
>
> -----Original Message-----
> From: Krishnan Subramanian [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 16, 2001 4:27 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Is it mandatory to have XADataSource for EJB transactional
> suport
>
>
> Laurel,
>
> You are absolutely right - I was ranting about the XA & distributed
> transactions and meant to discuss the java.sql.Connection class and the
> UserTrasaction in the same breath, but somewhere along I kinda forgot the
> UserTransaction.
>
> The EJB 1.1 spec does state that a BMP enterprise bean cannot call the
> Connection.commit or rollback while in the _midst_ of a transaction. or
for
> that matter even a setAutoCommit.
>
> -krish
>
> On Tue, 15 May 2001 18:24:06 -0500, Laurel Neustadter
> <[EMAIL PROTECTED]> wrote:
>
> >According to section 11.3.3 of the EJB 1.1 Specification, a bean may NOT
> >control the transaction via the Connection (e.g., may not invoke commit()
> or
> >rollback() on the java.sql.Connection interface). For bean-managed
> >transaction demarcation, you must use the UserTransaction interface.
> >
> >I may be mis-interpreting the post below, but it seems to imply that you
> can
> >use the Connection interface to control and demarcate transactions in an
> >EJB.
> >
> >I don't know the implications of doing commit/rollback on the Connection
> >itself in the case of one data source only.
> >
> >Laurel
> >
>
>
===========================================================================
> 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".
>
>
David Bullock
LISAsoft Project Lead
Sun Certified Programmer for the Java 2 Platform
email: [EMAIL PROTECTED]
mobile: +61 4 0290 1228
"The key ingredients of success are a crystal-clear goal,
a realistic attack plan to achieve that goal,
and consistent, daily action to reach that goal."
Steve Maguire, "Debugging the Development Process".
LISAsoft
http://www.lisasoft.com/
Adelaide Sydney
-------------------- ------------------------
38 Greenhill Rd Level 3, 228 Pitt Street
Wayville S.A. 5034 Sydney NSW 2000
Australia Australia
PH +61 8 8272 1555 PH +61 2 9283 0877
FAX +61 8 8271 1199 FAX +61 2 9283 0866
-------------------- ------------------------
===========================================================================
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".