1. A computer-implemented method comprising: providing in a database layer, a database engine and a database comprising data organized according to a relational model; providing in an application layer, an entity relationship data model and a query engine in communication with the database engine; causing the database engine to receive from via the query engine a query in a database language that has been extended to include an entity type and an association, the query further comprising a path expression including a filter element suffix followed by nested projection clauses specifying a relationship between a specified entity and an associated entity; causing the database engine to return to the query engine a query result set comprising data of the associated entity matching the nested projection clauses of the path expression, wherein if the path expression includes an optional flattening symbol, the query result set comprises the data in a result set type structure that is flattened, and wherein if the path expression omits the optional flattening symbol, the query result set comprises the data in the result set type structure that corresponds to the nested projection clauses; and causing the database engine to store the data in the database according to the result set type structure.