Tim,

That's basically my take on the situation as well (and I went through
similar agonizing to
arrive at the conclusion). Further, after you call findLargeAccounts(), you
_still_ don't
have what you really want -- you have to iterate over the set of references
and coax
the detail info out of each one. I found the
query-in-the-wrapping-session-bean approach
for getting aggregate info to be the most aesthetically pleasing.

Tom

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

-----Original Message-----
From: Tim Shephard <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Wednesday, May 12, 1999 6:19 PM
Subject: findLargeAccounts - why bother?


>Say you wanted to show the large accounts in a client side Table GUI
>component.
>
> The original take on this was that querying for the Primary Keys,
returning
>the primary keys, and then
>getting each primary key in turn from the AccountHome was horrendously
>expensive.
>
>Rather we saw that one call to a session bean which created helper
>objects(basically a lightweight table row version of the Account bean) from
>one SQL select statement which return them in a collection of some sort was
>much more realistic.
>
>The second take was that it was a session bean that talks back and forth to
>the entity bean, so bandwidth wasn't a terrible problem.
>
>The third take was that these entity beans are being created, when 99% of
>them aren't going to be accessed except for the summary information.  And
it
>still didn't seem realistic to do a 100 select statements (to load each
>Account) versus just one (to just create the summary objects).
>
>To be more clear, use this code instead in a session bean..
>
>public Vector getLargeAccounts()
>   throws RemoteException
>{
>  ResultSet rs=m_conn.prepareStatement("SELECT name, accountid, deposit
FROM
>accounts where deposit > 10000");
>
>  Vector v=new Vector();
>
>  while(rs.next())
>      v.addElement(new AccountSummary(rs.getString(1), rs.getInt(2),
>rs.getDouble(3)));
>
>  return v;
>}
>
>===========================================================================
>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