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).

"Lee, Steven" wrote:

> 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".

Reply via email to