[JBoss-user] [Persistence CMP/JBoss] - Optimized loading.
From what I read in the manual the on_find will load me all the matched records, which may be a lot or even to much, therefore there is the on_load which only loads the page_size specified number of records. But in all the examples the on_find also has the page_size tag so now I am lost. Is this tag superfluous in case of on_find or are there other differences. Is there a different meaning for on_find and on_load when specified by a ejbfindBy or ejbSelect, and in a relation? Where to specify the read ahead tags on 1..n relations in order to: Load the fields of the related entity bean when accessing the getter from the 1 side. Loading all the entities (and eventually some of there field data) when accessing the getter from the n side. What do I have to specify where? Here is an example which may (hopefully) clarify my question I used XDoclet tags and the resulting xml is at the end. In an Entity Bean (called Leaf) there is a method to retrieve the links from this Leaf /** * * @ejb.interface-method * view-type = local * * @ejb.relation * name = fromLeaf-linkFroms * role-name = LeafLinkFromsRelationshipRole * * @jboss.relation-read-ahead * strategy = on-find * eager-load-group = allFields */ public abstract java.util.Collection getLinkFroms(); The Link class the related to Leaf contains the corresponding method /** * * @ejb.interface-method * view-type = local * * @ejb.relation * name = fromLeaf-linkFroms * role-name = LinkFromLeafRelationshipRole * * @jboss.relation * fk-column = FROMLEAF_PKLEAFID * related-pk-field = pkLeafId * * @jboss.load-group * name = allFields * * @jboss.relation-read-ahead * strategy = on-find * page-size = 1000 * eager-load-group = allFields */ public abstract com.ascom.opentas.as.element.internal.entitybeans.Leaf getFromLeaf(); In my jbosscmp-jdbc.xml file the corresponding entry looks like ejb-relation ejb-relation-namefromLeaf-linkFroms/ejb-relation-name ejb-relationship-role ejb-relationship-role-nameLinkFromLeafRelationshipRole/ejb-relationship-role-name key-fields/ read-ahead on-find page-size1000/page-size eager-load-groupallFields/eager-load-group /read-ahead /ejb-relationship-role ejb-relationship-role ejb-relationship-role-nameLeafLinkFromsRelationshipRole/ejb-relationship-role-name key-fields key-field field-namepkLeafId/field-name column-nameFROMLEAF_PKLEAFID/column-name /key-field /key-fields read-ahead on-find eager-load-groupallFields/eager-load-group /read-ahead /ejb-relationship-role /ejb-relation We currently are using jboss-3.2.6RC2 (with JRE 1.4.2_07) together with Oracle9i as DB Many many thanks for any help, information or suggestion to a person in distress. Percy Christian View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3875381#3875381 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3875381 --- 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=6595alloc_id=14396op=click ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence CMP/JBoss] - Optimized loading Without Transactions
Hello, I have several SessionBean methods which retrieve lists os records from the DB. If I wan't these methods to have no transaction, how can I avoid the performance penalty referred on the book JBossCMP (Chapter 6-Optimized Loading-Transactions)? Book Excerpts: The performance impact of running without a transaction will be demonstrated with an example similar to Listing 6-1. This example uses an on-find optimized query that selects the first four gangsters (to keep the result set small), and it is executed without a wrapper transaction. Normally this would be the only query executed, but since this code is not running in a transaction, all of the preloaded data is thrown away as soon as findAll returns. Then at Arrow 2 JBossCMP executes the following four queries (one for each loop): 21... How can I avoid this penalty on methods without Transactions? Thanks in advance, Victor Batista View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=3861479#3861479 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3861479 --- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user