Armin,
It was the cache setting not the lazy loading.Fast as lightning again ;-)
Strange though that without caching the 2nd number of queries is less?
thanks,
Dennis
did you notice that the ObjectCache configuration moved from
OJB.properties to repository file between rc7 and 1.0.4?
You have to declare the cache within the jdbc-connection-descriptor
using a object-cache element.
http://db.apache.org/ojb/docu
Does that mean that there is no caching at all now? Maybe that's the reason
why there are more queries in 1.0.4.
The thing is that I get just one query ,no joins, when i select all
organisations from rc7 while there are some references that are not
interfaces so they cannot be proxies anyway?? When I select 1 organisation I
get all reference data with it when I call the getters.
Calling all orgs on 1.0.4 I gives outer joins the 2nd time. :
SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version ,A0.fax,
A0.fieldofinterest,A0.name,A0.noofemployee,A0.phone,A0.postaladress,
A0.postalcity,A0.postalzip,A0.url,A0.visitadress,A0.visitcity,
A0.visitzip,
A0.chamberofcommerceno ,A0.immediateparentid,A0.ultimateparentid,
A0.postalcountryid,A0.organisationbrancheid,A0.visitcountryid,
A0.organisationtypeid FROM organisation A0
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl ] DEBUG:
SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.code,
A0.name,
A0.number FROM country A0 WHERE A0.id = ?
regards,
Dennis
2006/1/9, Armin Waibel [EMAIL PROTECTED]:
Hi Dennis,
if I summarize your posted sql-queries we will get
1.0.4:
FROM organisation A0
FROM country A0 WHERE A0.id = ?
FROM tablemodel A0 WHERE A0.name = ?
FROM field A0 WHERE A0.id = ?
FROM fieldtype A0 WHERE A0.id = ?
FROM reference A0 WHERE A0.parenttablemodelid = ?
FROM rendertype A0 WHERE A0.id = ?
FROM tablemodel A0 WHERE A0.id IN (?,?,?,?)
FROM field A0 WHERE A0.id IN (?,?)
FROM fieldtype A0 WHERE A0.id = ?
FROM field A0 WHERE A0.parenttablemodelid = ?
FROM fieldtype A0 WHERE A0.id IN (?,?,?)
FROM tablemodel A0 WHERE A0.id = ?
rc7:
FROM organisation A0
FROM country A0 WHERE A0.id = ?
FROM tablemodel A0 WHERE A0.name = ?
FROM field A0 WHERE A0.parenttablemodelid = ?
FROM fieldtype A0 WHERE A0.id IN (?,?)
FROM reference A0 WHERE A0.parenttablemodelid = ?
Seems that lazy loading works, because there is no query for the m:n and
1:n references. Think the other queries are the result of the 1:1
references and additional queries if the referenced object has
references too or some prefetching stuff.
If this is the case you could try to enable lazy loading for some 1:1
references too and check the generated queries again.
you post
ProxyFactoryClass=org.apache.ojb.broker.core.proxy.ProxyFactoryCGLIBImpl
ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
did you notice that the ObjectCache configuration moved from
OJB.properties to repository file between rc7 and 1.0.4?
You have to declare the cache within the jdbc-connection-descriptor
using a object-cache element.
http://db.apache.org/ojb/docu/guides/objectcache.html
regards,
Armin
Dennis Bekkering wrote:
Hello,
I recently switched from rc7 to 1.0.4 and lazy loading seem to happen
any
more. Can someone please check my config out.
1.0.4 fires twice as much queries?
thanks.
sql output get all organisations 1.0.4
just after clear cache
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.fax,
A0.fieldofinterest, A0.name,A0.noofemployee,A0.phone,A0.postaladress,
A0.postalcity,A0.postalzip,A0.url,A0.visitadress,A0.visitcity,
A0.visitzip,
A0.chamberofcommerceno,A0.immediateparentid,A0.ultimateparentid,
A0.postalcountryid ,A0.organisationbrancheid,A0.visitcountryid,
A0.organisationtypeid FROM organisation A0
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT A0.id ,A0.lastmodified,A0.creationdate,A0.version,A0.code,
A0.name,
A0.number FROM country A0 WHERE A0.id = ?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl ] DEBUG:
SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,
A0.defaultvalue,
A0.fixheader,A0.groupby,A0.indescriptor,A0.name,A0.subtablesheight ,
A0.descriptorfieldid,A0.defaultqueryid,A0.quicksearchqueryid FROM
tablemodel
A0 WHERE A0.name = ?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,
A0.defaultvalue,
A0.indescriptor,A0.name,A0.ordr,A0.showintable,A0.sortdown,
A0.fieldtypeid ,
A0.fieldcollectionid,A0.parenttablemodelid,A0.calculatedfieldid FROM
field
A0 WHERE A0.id = ?
[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG:
SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.name,
A0.typeFROM
fieldtype A0 WHERE
A0.id = ?
[