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 = ? > > [ org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > > SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version, > A0.defaultvalue, > > A0.name ,A0.ordr,A0.property,A0.selectionpath,A0.showintable, > > A0.parentcollectionmodelid,A0.innerselectid,A0.parenttablemodelid, > > A0.rendertypeid,A0.entityid FROM reference A0 WHERE > A0.parenttablemodelid = > > ? > > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > > SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.name, > > A0.referenceid FROM rendertype 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.id IN (?,?,?,?) > > [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 IN (?,?) > > [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 = ? > > [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.parenttablemodelid = ? > > [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 IN (?,?,?) > > [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.id = ? > > > > second time > > > > [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 = ? > > > > > > sql output get all organisations rc7 > > > > just after clear cache > > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > > SQL:SELECT A0.organisationbrancheid,A0.ultimateparentid,A0.phone, > > A0.immediateparentid,A0.visitcountryid,A0.visitzip,A0.postalzip , > A0.visitcity > > ,A0.visitadress,A0.postaladress,A0.fax,A0.id,A0.version, > A0.postalcountryid, > > A0.postalcity,A0.chamberofcommerceno,A0.organisationtypeid,A0.url, > > A0.noofemployee ,A0.name,A0.creationdate,A0.lastmodified, > A0.fieldofinterestFROM > > organisation A0 > > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > > SQL:SELECT A0.code ,A0.name,A0.creationdate,A0.id,A0.number,A0.version, > > A0.lastmodified FROM country A0 WHERE A0.id = ? > > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl ] DEBUG: > > SQL:SELECT A0.indescriptor,A0.groupby,A0.defaultqueryid, > A0.descriptorfieldid > > ,A0.id,A0.quicksearchqueryid,A0.version,A0.fixheader,A0.name, > A0.creationdate > > ,A0.lastmodified,A0.defaultvalue,A0.subtablesheight FROM tablemodel A0 > WHERE > > A0.name = ? > > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > > SQL:SELECT A0.ordr,A0.property,A0.selectionpath,A0.id,A0.version, > > A0.innerselectid,A0.rendertypeid,A0.parentcollectionmodelid, > > A0.parenttablemodelid,A0.entityid,A0.name ,A0.creationdate, > A0.showintable, > > A0.lastmodified,A0.defaultvalue FROM reference A0 WHERE > > A0.parenttablemodelid = ? > > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > > SQL:SELECT A0.indescriptor,A0.ordr,A0.id,A0.version,A0.calculatedfieldid > , > > A0.sortdown,A0.parenttablemodelid,A0.fieldtypeid,A0.name,A0.creationdate > , > > A0.showintable ,A0.fieldcollectionid,A0.lastmodified,A0.defaultvalueFROM > > field A0 WHERE A0.parenttablemodelid = ? > > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: > > SQL:SELECT A0.type, A0.name,A0.creationdate,A0.id,A0.version, > A0.lastmodifiedFROM > > fieldtype A0 WHERE > > A0.id IN (?,?) > > > > second time > > [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl ] DEBUG: > > SQL:SELECT A0.organisationbrancheid,A0.ultimateparentid,A0.phone, > > A0.immediateparentid,A0.visitcountryid,A0.visitzip,A0.postalzip, > A0.visitcity > > ,A0.visitadress,A0.postaladress,A0.fax, A0.id,A0.version, > A0.postalcountryid, > > A0.postalcity,A0.chamberofcommerceno,A0.organisationtypeid,A0.url, > > A0.noofemployee,A0.name,A0.creationdate,A0.lastmodified, > A0.fieldofinterestFROM > > organisation A0 > > > > > > org descriptor > > > > <class-descriptor class="com.myvision.model.Organisation" > > table="organisation"> > > <field-descriptor name="id" column="id" jdbc-type="INTEGER" > > primarykey="true" autoincrement="true"/> > > <field-descriptor name="lastModified" column="lastmodified" > > jdbc-type="TIMESTAMP"/> > > <field-descriptor name="creationDate" column="creationdate" > > jdbc-type="TIMESTAMP"/> > > <field-descriptor name="version" column="version" > jdbc-type="INTEGER"/> > > <field-descriptor name="fax" column="fax" jdbc-type="VARCHAR"/> > > <field-descriptor name="fieldOfInterest" column="fieldofinterest" > > jdbc-type="LONGVARCHAR"/> > > <field-descriptor name="name" column="name" jdbc-type="VARCHAR"/> > > <field-descriptor name="noOfEmployee" column="noofemployee" > > jdbc-type="INTEGER"/> > > <field-descriptor name="phone" column="phone" jdbc-type="VARCHAR"/> > > <field-descriptor name="postalAdress" column="postaladress" > > jdbc-type="VARCHAR"/> > > <field-descriptor name="postalCity" column="postalcity" > > jdbc-type="VARCHAR"/> > > <field-descriptor name="postalZip" column="postalzip" > > jdbc-type="VARCHAR"/> > > <field-descriptor name="url" column="url" jdbc-type="VARCHAR"/> > > <field-descriptor name="visitAdress" column="visitadress" > > jdbc-type="VARCHAR"/> > > <field-descriptor name="visitCity" column="visitcity" > > jdbc-type="VARCHAR"/> > > <field-descriptor name="visitZip" column="visitzip" > jdbc-type="VARCHAR"/> > > <field-descriptor name="chamberOfCommerceNo" > column="chamberofcommerceno" > > jdbc-type="VARCHAR"/> > > <reference-descriptor name="immediateParent" class-ref=" > > com.myvision.model.Organisation"> > > <foreignkey field-ref="immediateParentId"/> > > </reference-descriptor> > > <field-descriptor name="immediateParentId" column="immediateparentid" > > jdbc-type="INTEGER"/> > > <reference-descriptor name="ultimateParent" class-ref=" > > com.myvision.model.Organisation "> > > <foreignkey field-ref="ultimateParentId"/> > > </reference-descriptor> > > <field-descriptor name="ultimateParentId" column="ultimateparentid" > > jdbc-type="INTEGER"/> > > <reference-descriptor name="postalCountry" class-ref=" > > com.myvision.model.Country"> > > <foreignkey field-ref="postalCountryId"/> > > </reference-descriptor> > > <field-descriptor name="postalCountryId" column="postalcountryid" > > jdbc-type="INTEGER"/> > > <reference-descriptor name="organisationBranche" class-ref=" > > com.myvision.model.OrganisationBranche"> > > <foreignkey field-ref="organisationBrancheId"/> > > </reference-descriptor> > > <field-descriptor name="organisationBrancheId" > > column="organisationbrancheid" jdbc-type="INTEGER"/> > > <reference-descriptor name="visitCountry" class-ref=" > > com.myvision.model.Country "> > > <foreignkey field-ref="visitCountryId"/> > > </reference-descriptor> > > <field-descriptor name="visitCountryId" column="visitcountryid" > > jdbc-type="INTEGER"/> > > <reference-descriptor name="organisationType" class-ref=" > > com.myvision.model.OrganisationType"> > > <foreignkey field-ref="organisationTypeId"/> > > </reference-descriptor> > > <field-descriptor name="organisationTypeId" > column="organisationtypeid" > > jdbc-type="INTEGER"/> > > <collection-descriptor name="projectList" element-class-ref=" > > com.myvision.model.Project " auto-retrieve="true" auto-update="true" > > proxy="true" auto-delete="false"> > > <inverse-foreignkey field-ref="parentOrganisationId"/> > > </collection-descriptor> > > <collection-descriptor name="contactList" element-class-ref=" > > com.myvision.model.Contact" auto-retrieve="true" auto-update="true" > > proxy="true" auto-delete="false"> > > <inverse-foreignkey field-ref="parentOrganisationId"/> > > </collection-descriptor> > > <collection-descriptor name="bankAccountList" element-class-ref=" > > com.myvision.model.BankAccount " auto-retrieve="true" auto-update="true" > > > proxy="true" auto-delete="false"> > > <inverse-foreignkey field-ref="parentOrganisationId"/> > > </collection-descriptor> > > <collection-descriptor name="smsMessageList" element-class-ref=" > > com.myvision.model.SmsMessage" auto-retrieve="true" auto-update="true" > > proxy="true" auto-delete="false"> > > <inverse-foreignkey field-ref="parentOrganisationId"/> > > </collection-descriptor> > > </class-descriptor> > > > > > > OJB.properties: > > > > ProxyFactoryClass=org.apache.ojb.broker.core.proxy.ProxyFactoryCGLIBImpl > > ObjectCacheClass= org.apache.ojb.broker.cache.ObjectCacheDefaultImpl > > > > class > > > > <class-descriptor class="com.myvision.model.Note " table="note"> > > > > one2many > > > > <collection-descriptor name="declarationSheetLines" > element-class-ref=" > > com.myvision.model.DeclarationSheetLine " auto-retrieve="true" > > auto-update="true" proxy="true" auto-delete="false"> > > <inverse-foreignkey field-ref="parentDeclarationSheetId"/> > > </collection-descriptor> > > > > many2many > > > > <collection-descriptor name="attachmentList" element-class-ref=" > > com.myvision.model.Attachment" auto-retrieve="true" auto-update="true" > > proxy="true" indirection-table="note_attachmentlist_2_attachment"> > > <fk-pointing-to-this-class column="attachmentListId"/> > > <fk-pointing-to-element-class column="attachmentId"/> > > </collection-descriptor> > > > > ref > > > > <reference-descriptor name="parentTableModel" class-ref=" > > com.myvision.model.TableModel"> > > > > mvg, > > Dennis > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- mvg, Dennis
