1 Reply Latest reply on Feb 15, 2007 2:29 AM by kanth_seenu

    read-ahead and optimization

    kanth_seenu

      4.0.1sp1 version of jboss.

      In order to optimize the execessive queries fired to database by getter methods, I tried using the read-ahead tag. I have given the details about my configuration

      * @jboss.load-group
      * name="modules"
      * description="module fields used in query"
       * @jboss.read-ahead strategy = "on-find"
       * page-size = "200"
       * eager-load-group="modules"
      
       * @ejb.finder
       * signature="java.util.Collection findByTaskId(java.lang.Long taskid)"
       * query="SELECT DISTINCT OBJECT(o) FROM Task o WHERE o.taskid = ?1"
       * description=""
       * @jboss.query
       * description="This generates jboss-ql and overwrites the original query "
       * signature="java.util.Collection findByTaskId(java.lang.Long taskid)"
       * query="SELECT DISTINCT OBJECT(o) FROM Task o WHERE o.taskid = ?1"
       * eager-load-group="modules"
       * strategy="on-find"
       * page-size="200"


      Add added @jboss.load-group name="modules" to my getter methods

      but still I don't see any cache/optimization happening with my sql queries, issue persists

      I have also removed the readonly attribute that I had set to the getter methods.

      How to use the read-ahead attribute?



        • 1. Re: read-ahead and optimization
          kanth_seenu

          On further reading I understood that the finder method and the getter must be a part of the same transaction. Better approach would be to use the @ejb.value-object, and use the getData() method from the localobject, and ignore read-aheads