You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ol...@ppi.de on 2003/09/17 15:20:43 UTC

superflous, long queries in CVS HEAD (Batch retrieval)

Hello,

I noticed that several of my tests require more
SQL statements than in rc4, 
among them ones without WHERE-clause, i.e.
	select ... FROM A

I debugged into it and saw that this seems
to be caused by null-references:

Say I have a class A with a collection of B,
and B has a reference of type C.  Suppose
I load an instance of A and (by batch retrieval)
load the corresponding collection of B (say of size 1).
Suppose in that B instance the corresponding 
foreignkey field (of type Long) is null.  When 
the method 
  buildPrefetchCriteriaSingleKey(ids, pkField)
is called for that field, the (only) fkVal will be null,
and hence fkValues will be empty.  Consequently, the 
line 207
	crit.addIn(pkField.getAttributeName(), fkValues);
is never reached.  This (potentially long running)
query on the table of C is then executed in 
  RelationshipPrefetcherImpl.associateBatched()

This behaviour seems to have been introduced together
with the Batch retrievals on 25. Aug.

I will try to reproduce the problem in a test case.

Olli



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org