Ali has posted 1 posts at DZone. View Full User Profile

Autofetch - Eliminate association fetch specifications

02.27.2008
| 3436 views |
  • submit to reddit
Autofetch addresses a common problem with object relational mapping tools like Hibernate: programmers have to specify the right association fetch strategies. In Hibernate, you can specify these in the configuration files or in queries (fetch joins). If you don't get it right, you can have poor preformance becauase you make too many round-trips to the database. In the worst case you get the n+1 selects problem. Even if the programmer gets the association fetch strategy correct for each query the program's modularity is compromised because changes in the traversal pattern of the program require changes in their correpsonding queries. This is especially apparent when your traversals take place in the view layer and your query code is in the data layer. Now there is an implicit performance dependency between the two.

Autofetch addresses this by automatically adding the right association fetch directives into your queries. It dynamically monitors a program's traversals off of query results and classifies queries to figure out what associations need to be fetched/prefetched. Programs are easier to write and more modular. It is designed to integrate with any object persistence framework, but right now there is only a Hibernate connector. The library is open source LGPL and the website is http://www.cs.utexas.edu/~aibrahim/autofetch/. The details of Autofetch were published in ECOOP 2006. Let me know if you have questions.
0
Average: 3 (1 vote)
Published at DZone with permission of its author, Ali .

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)