Why not just one query? 

-----Original Message-----
From: Filip Hanik
To: [EMAIL PROTECTED]
Sent: 5/7/01 9:39 PM
Subject: RE: [JBoss-dev] TODO: JBossCMP 1.1 FAST!

> Sorry lets put that in context, need to eliminate N+1 query problem
first.
> Reduce trips to the database is #1.  Then make the trips more
efficient.

yes, 2 queries should be enough assuming that one bean's data can be
contained within one row.

query 1: is the finder query that returns the primary key objects.
query 2: is the retrieve query that returns the data for the actual
entity
beans.

if query 2 is constructed in such a way that
a) select ...all data that needs to be collected... from table
b) where ...same where clause as the find query...AND (additional joins
if
needed)

as you can see. since query 1 and query 2 should have similar where
clauses,
there is no need to execute "select ...data... from table where key = ?"
N
number of times.

does this makes sense to you, so in this case each findXXX:Collection
would
only require two queries.


Filip

~
Namaste - I bow to the divine in you
~
Filip Hanik
Software Architect
[EMAIL PROTECTED]
www.filip.net


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to