>This is not always the case, some app server (WebLogic for instance)) will
not
>necessarly do N+1 queries for a finder.
>Weblogic caches the data and will do only one query most of the time. (This
is
>true at least if the "dbIsShared" is false for the bean).

But only if the database is NOT shared with other systems other than the EJB
server,
which is not very practical. If the database is shared WebLogic recommends
to
disable the data caching.

This listing performance problem is one of the main reasons why we are not
using
entity beans yet, only session beans. The other is our fear that interbean
communications may not be optimized for EBs in the same container.
For this reasons we rather use a generic session bean to deal with all our
DB tables raher than *lots* or entity beans, one for each table or domain
object.

BTW this "generic session bean" uses introspection and Ejipt-like properties
files to
handle the persistence of any JavaBean. The properties files map fields to
table columns ... a kind of CMP for session beans, so to speak.

That's what I call a "coarse grained" bean indeed ;-)

Best regards

    Javier Borrajo
    www.tid.es

>> I think we all know that for each finder method that returns N rows
>> that there are at least N+1 queries for the simple case
>> (one table - one bean).
>>
>> Does it seem reasonable to instead perform only ONE select
>> statement and cache the results around myself ???
>>
>> I could do the following:
>>
>> 1) Change Finder methods to select all of the data
>>    (Select * from table) and not just the primary key
>>    information.
>>
>> 2) Create customized Enumeration classes for our ejbFind methods.
>>
>>   class TablePKEnum implements Enumeration
>>   {
>>     TablePKEnum(ResultSet rs)
>>     boolean hasMoreElements()
>>
>>     // returns a TablePK AS NEEDED and
>>     // CACHES all other data
>>     Object nextElement()
>>   }
>>
>> 3) Check Cache during ejbLoad
>>
>> All of the Entity beans are using TX_REQUIRED.
>>
>> Are there any special considerations to take into account?
>>
>> Is there a better way?
>>
>> Thanks,
>> -Steven
>>
>>
===========================================================================
>> 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".
>
>--
>-----
>Emmanuel Pirsch
>Sun Certified Java Programmer
>Unite for Java! - http://www.javalobby.org/
>---
>"The intuitive mind is a sacred gift and the rational mind is a faithful
servant. We have created a society that honors the servant and has forgotten
the gift."
>        - Albert Einstein.
>
>===========================================================================
>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