I think the person was asking for BMP? So that typically means when the bean
is loading its state or saving its state - not when doing business logic. So
as per Section 9.5.2 (in public draft 2, I didn't bother to print a later
one), that should be ejbCreate, ejbLoad, ejbStore and ejbRemove - each time
opening and closing the database connection.

----- Original Message -----
From: "Avi Kivity" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 23, 2000 12:08 AM
Subject: Re: [EJB-INT] Database Connection


> > We are working on Bean Managed Persistent Entity Beans. We
> > got a mail now
> > from our DBA that there are around 200 sessions open in the
> > Oracle Server.
> > This could be because our connection.close statements don't
> > work or maybe
> > don't get called. Could anyone tell me which is the right place in an
> > Entity Bean to:
> > 1. Open Connection
>
> Immediately before you start using it.
>
> > 2. Close Connection
> >
>
> Immediately after you finish using it.
>
> This means a business method looks something like
>
> void businessMethod(args) {
>     Connection conn = null;
>     try {
>          conn = acquireConnection();
>          // JDBC access (do not issue a commit)
>     } finally {
>         try { conn.close(); } catch (Exception ignore) {}
>     }
> }
>
> In case it looks inefficient, don't worry: the app server will pool the
> connections, and only a few will be actually opened.
>
> Getting the connections in setEntityContext is wrong transaction-wise as
> well as inefficient.

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