The app server's behavior is a reasonable interpretation of the spec, which
indicates that
transactions should be begun with ejbLoad() and end with ejbStore().

Some app servers (Weblogic, for example) provide the ability to
short-circuit this
behavior. You can do something similar by maintaining a boolean flag to
indicate
whether or not your entity bean's state data has been modified, and then
testing
for this in ejbLoad() and ejbStore().

for example
    public void ejbStore()
    {
        if (isDirty)
        {
            //write state to database
        }
        //else just drop through without doing anything.
    }

Caution: if you do this, you need to ensure that your entity bean is the
_only_
piece of software that uses the underlying table. Otherwise you get
situations
like:
    1) Your application loads a row (yeah, I'm a relational weenie. So sue
me!).
    2) Another application updates the row.
    3) Someone uses your bean. They can't see the update that happened
    to the underlying table. Worse, if they issue an update of their own,
    the stale data will be written back to the database, overwriting the
    update from step 2).



===========================================================================
  Tom Valesky   -- [EMAIL PROTECTED]
       http://www.patriot.net/users/tvalesky

-----Original Message-----
From: Manisha Umbarje <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, June 14, 1999 9:08 PM
Subject: Application Server container related question


>Hi,
>
>I am new on this EJB interest group.. I don't know if this issue has
>already been discussed. I have been trying to access Bean Managed Entity
>Bean's remote methods from the servlet. I have implemented the method
>ejbFindByName() which returns Enumeration of Primary Key class of the
>Entity Bean and then I try to execute different methods on this object.
>But when I do so, I observed in the trace file of my application server
>that container is making  calls to ejbLoad() every time I try to call
>remote method. It seems that Container is trying to synchronize Bean's
>state to DB state.
>
>That makes my application very slow.
>
> Is this way it should behave or am I missing something ?
>
>Manisha
>
>===========================================================================
>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