AutoFetch in
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
is a mechanism for automatically tuning
object-relational mapping queries.
Ali Ibrahim and William Cook at the University of Texas at Austin developed the idea of "AutoFetch" including an implementation fo
Hibernateand followed later by an implementation in
Ebean
Ebean is an object–relational mapping product written in Java. It is designed to be simpler to use and understand than JPA (Java Persistence API) or JDO (Java Data Objects) products.
Simple API
Ebean has a simpler API than JPA. It achieves thi ...
.
Benefits
Improving the modularity of application code
AutoFetch uses the program state (typically the
call stack
In computer science, a call stack is a stack data structure that stores information about the active subroutines of a computer program. This kind of stack is also known as an execution stack, program stack, control stack, run-time stack, or mach ...
) to classify queries.
This means that AutoFetch can tune the same query depending on HOW it was called.
For example, a Data Access API such as
findCustomer(int customerId)
can be tuned differently depending on the callers of the method.
Reducing the development and maintenance burden from Developers
Because AutoFetch automatically gathers the profiling information developers do not need to manually try and gather this information and apply performance optimizations to the code.
AutoFetch can monitor the object graph usage so that if the usage changes the tuning of the query can change to suit. This reduces the code maintenance issues for developers and maintains optimal performance as usage changes over time.
How it works
AutoFetch collects object graph usage when queries are executed. It collects the 'profile' information which is later used to automatically tune the query on subsequent executions. The ORM query is tuned by determining and automatically adding the correct prefetch directives for each query.
This improves the performance of the application by reducing "lazy loading". For ORMs that support partial objects AutoFetch can also tune the query by just including the properties that the application uses rather than all properties.
See also
*
Object-relational mapping
*
Hibernate
Hibernation is a state of minimal activity and metabolic depression undergone by some animal species. Hibernation is a seasonal heterothermy characterized by low body-temperature, slow breathing and heart-rate, and low metabolic rate. It most ...
*
Ebean
Ebean is an object–relational mapping product written in Java. It is designed to be simpler to use and understand than JPA (Java Persistence API) or JDO (Java Data Objects) products.
Simple API
Ebean has a simpler API than JPA. It achieves thi ...
References
{{Reflist
External links
* https://web.archive.org/web/20080418084615/http://www.cs.utexas.edu/~aibrahim/autofetch/
* http://sourceforge.net/projects/autofetch/
Object-relational mapping