Hi, I have a very simple EJB deployed to jboss 3.2.6 + postgresql 8 + java 1.4.2_06 + suse linux 9.2
I use the following code to make a list: | HashMap[] certificazioneArray = new HashMap[certificazioni.size()]; | Iterator iCertificazioni = certificazioni.iterator(); | int idx=0; | while(iCertificazioni.hasNext()) | { | CertificazioneLocal cert = (CertificazioneLocal)iCertificazioni.next(); | | HashMap certBean = new HashMap(); | | certBean.put("id",cert.getId()); | certBean.put("chiusa",cert.getChiusa()); | certBean.put("simulazione",cert.getSimulazione()); | certBean.put("numeroRomano",cert.getNumeroRomano()); | certBean.put("data",cert.getData()); | | certificazioneArray[idx++]=certBean; | } | | Problem is that for each get method jBoss fires a query to the database. Using the documentation, I have tried to optimize the sql using load groups (from my jbosscmp-jdbc): | <entity> | <ejb-name>Certificazione</ejb-name> | | <read-ahead> | <strategy>on-find</strategy> | <page-size>1000</page-size> | <eager-load-group>lista</eager-load-group> | </read-ahead> | | <table-name>certificazione</table-name> | | <load-groups> | <load-group> | <load-group-name>lista</load-group-name> | <field-name>chiusa</field-name> | <field-name>simulazione</field-name> | <field-name>numeroRomano</field-name> | <field-name>data</field-name> | </load-group> | </load-groups> | | <query> | <query-method> | <method-name>findAll</method-name> | <method-params></method-params> | </query-method> | <jboss-ql>select object(o) from Certificazione as o order by o.numero</jboss-ql> | </query> | </entity> | Nothing seams to change and five queries are still fired. If I change the <commit-option> in jboss.xml to A, jboss fires only on sql statement to the database but apparently speed speed is much more better. The code I am using for making the list is not into a transaction. What's wrong ? Where can I find more documentation on these issues ? Thank you. Fabrizio >From my ejb-jar: | <entity> | <description>Entity Bean ( CMP )</description> | <display-name>Certificazione</display-name> | <ejb-name>Certificazione</ejb-name> | <local-home>my.ejb.CertificazioneLocalHome</local-home> | <local>my.ejb.CertificazioneLocal</local> | <ejb-class>my.ejb.CertificazioneBean</ejb-class> | <persistence-type>Container</persistence-type> | <prim-key-class>java.lang.Long</prim-key-class> | <reentrant>False</reentrant> | <cmp-version>2.x</cmp-version> | <abstract-schema-name>Certificazione</abstract-schema-name> | <cmp-field> | <field-name>id</field-name> | </cmp-field> | <cmp-field> | <field-name>numero</field-name> | </cmp-field> | <cmp-field> | <field-name>data</field-name> | </cmp-field> | <cmp-field> | <field-name>simulazione</field-name> | </cmp-field> | <cmp-field> | <field-name>chiusa</field-name> | </cmp-field> | <cmp-field> | <field-name>numeroRomano</field-name> | </cmp-field> | <primkey-field>id</primkey-field> | <query> | <query-method> | <method-name>findAll</method-name> | <method-params/> | </query-method> | <ejb-ql>select object(o) from Certificazione o</ejb-ql> | </query> | </entity> | | ...... | | <container-transaction> | <method> | <ejb-name>Certificazione</ejb-name> | <method-name>*</method-name> | </method> | <trans-attribute>Required</trans-attribute> | </container-transaction> | View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3867890#3867890 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3867890 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user