29. A method implemented in a query system, the method comprising: building objects in memory based upon a view type referenced in a query received from an application; and applying query rewrite optimizations to the query referencing the view type, wherein the query rewrite optimizations determine which portions of the query to push down to a database at a second tier for resolution and which portions of the query are to be processed by the query engine at a first tier to build objects from the view types.
29. A method implemented in a query system, the method comprising: building objects in memory based upon a view type referenced in a query received from an application; and applying query rewrite optimizations to the query referencing the view type, wherein the query rewrite optimizations determine which portions of the query to push down to a database at a second tier for resolution and which portions of the query are to be processed by the query engine at a first tier to build objects from the view types. 30. The method of claim 29, wherein the step of applying query rewrite optimizations further comprises: restricting a result set, by a database where the data resides, for predicates that can be pushed down to the database; building an object in memory, before applying remaining predicates, that cannot be pushed down, in object space if the remaining predicates involve a method, or if the remaining predicates involve a function that references objects as function arguments; and applying the remaining predicates, that define the query's results, in object space after retrieving complete sets of data referenced in the query.