Michael,
Don't worry about checking for the fields whether to read or not read the
database.
This should be taken care of by the container.

The container will call ejbLoad() when it needs the data.
The reason your approach might fail is because the container may use the
same entity bean (java object)
and replace the fields with data from another row. If you don't respond
properly to the ejbLoad method the container might think that your EJB bean
is another data row since you didn't read.

So the container might be pooling java objects and just replacing the
fields, so be careful.

Filip





                    Michael Pikounis
                    <mpikounis@HOTMAI        To:     [EMAIL PROTECTED]
                    L.COM>                   cc:
                    Sent by: A               Subject:     Re: Modelling Read Only 
Database Tables
                    mailing list for
                    Enterprise
                    JavaBeans
                    development
                    <EJB-INTEREST@jav
                    a.sun.com>


                    11/22/99 07:35 AM
                    Please respond to
                    A mailing list
                    for Enterprise
                    JavaBeans
                    development





Hello,

I have been following this conversation for a while and I am wondering
whether the following solution would be efficient:

* using BMP entity beans with no "setXXX" methods
* before going to the database to retrieve the rows, check if the
  entity bean properties are NULL. If they are, load them from the
  database, if they are not, assume they have already been loaded and
  use them without going to the database.

This way the entity bean only goes to the database once in its life-time
and
it can serve a number of clients. The assumption of course is that your
data
is static and will not change without re-starting the server.

Is there something wrong with this approach?

The reason I am not convinced with using session beans to access read only
data is that the session bean will have to go to the database for every
call. Is this not a performance hit?

Michael

>From: Frank Sauer <[EMAIL PROTECTED]>
>Reply-To: A mailing list for Enterprise JavaBeans development
><[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: Modelling Read Only Database Tables
>Date: Mon, 22 Nov 1999 07:34:06 -0500
>
>Using entity beans will make the performance much worse...
>retrieving the data from stateless session beans is the
>right way to do it for this scenario.
>
>Frank

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

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