Native Queries for Persistent Objects A Design White Paper
Short Description
Most persistence architectures for Java and .NET provide interfaces to execute queries written in an architecture-specific query language. These interfaces are string based: queries are defined in strings that are passed to the persistence engine for interpretation. String-based query interfaces have significant negative impact on programmer pro- ductivity. The queries are not accessible to development environment features like compile-time type checking, auto-completion, and refactoring. Programmers must work in two languages: the implementation language and the query language. This paper introduces Native Queries, a concise and type-safe way to express queries directly as Java and C# methods. We describe the design of Native Queries and provide an overview of implementation and optimization issues. The paper also includes a discussion of the advantages and disadvantages of the current design of Native Queries.
Website: www.odbms.org | Filesize: 140kb
No of Page(s): 12
Content
…
The developer could write queries without having to think about a custom query language or API. The IDE could actively help to reduce typos. Queries would be fully type safe and accessible to the refactoring features of the IDE. Queries could also be prototyped, tested, and run against plain collections in memory without a database backend.
At first sight, this approach seems unsuitable as a database query mech- anism. Naively executing Java/C# code against the complete extent of all stored objects of a class would incur a huge performance penalty, because all candidate objects would have to be instantiated from the database. A solution to this problem has been published in the paper on Safe Query Objects” by Cook and Rai[3]: The source code or the byte code of the Java/C# query expression can be analyzed and optimized by translating it to the underlying persistence system’s query language or API (SQL[6], OQL[1], JDOQL[9], EJBQL[11], SODA[10], etc.), and thereby take advan- tage of indexes and other optimizations of a database engine. In this paper we refine the original idea of safe query objects to provide a more concise and natural definition of native queries. We will also examine integrating queries into Java and .NET by leveraging more recent features of those language environments, including anonymous classes and delegates.
…
Get the file Download here
Related Books:Related Searches: s query language, optimization issues, rai 3, candidate objects, database backend
Comments
Leave a Reply