Implements the object-relational mapping.