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"
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