Date: 2004-11-10T06:53:16 Editor: JohannesTextor <[EMAIL PROTECTED]> Wiki: Cocoon Wiki Page: GettingStartedWithCocoonAndHibernate URL: http://wiki.apache.org/cocoon/GettingStartedWithCocoonAndHibernate
no comment Change Log: ------------------------------------------------------------------------------ @@ -10,7 +10,7 @@ ''outline skills and depth of knowledge required'' * You need to be proficient in Java, have basic SQL knowledge in case you want to do troubleshooting. * You should now how to translate your application domain into a solid database model. - * Understand the "lazy loading" concept that most O/R mapping tools use by default. This generally means that nothing is retrieved from the database until you really ask for it. [http://www.hibernate.org/162.html] + * Understand the "lazy loading" concept that most O/R mapping tools use by default. This generally means that nothing is retrieved from the database until you really ask for it. [http://www.hibernate.org/162.html]. Also see below for notes on lazy collection initialization. ''outline skills and depth of knowledge that would be useful'' @@ -121,10 +121,10 @@ == Performance Tuning and Optimum Configuration == -=== Lazy Collection Fetching === +=== Lazy Collection Initialization === -Lazy Collection Fetching is extremely important to ensure decent performance of your Hibernate application. By Default, -when fetching an object from the database, Hibernate makes sure that every other object reachable via getter methods is +Lazy Collection Initialization is an extremely important contribution to decent performance of your Hibernate application. +By Default, when fetching an object from the database, Hibernate makes sure that every other object reachable via getter methods is also available. Suppose you have an article object. Each article has a vector of related articles so users can comfortably browse to your @@ -190,12 +190,16 @@ {{{ <list name="relatedArticles" table="Article_Relations" lazy="true"> }}} -If you, like me, programmed a whole webapp without knowing about this feature, try it out and see that it will do wonders on +If you, like me, programmed a whole webapp without knowing about this feature, try it out and see that it will work wonders on overall performance :) Now, when fetching article A, it will only fetch article A. If, and only if, you acess article B via the relatedArticles List, it will connect to the DB again and fetch it dynamically. For this to work, ensure your Hibernate Session is left open until you have entirely finished working with your business objects. -=== Query Caching === +You should decide carefully where to use lazy initialization and where not; it is not always beneficial, since sometimes you might have +a collection whose elements are almost always accessed. Query monitoring is useful to find out whether you have set up lazy initialization +optimally. + +=== Query Caching === == Rich Application Interface ==
