Native Query Concepts

Database query is a language used to communicate with the database. For a long time databases stood the central and commanding place in software products: the applications were literally written to support the needs of a main central database. However, in the modern high-speed world of distribute computing the transfer and modification of the information plays increasingly important role and the databases more and more often take a place of a temporary storage or a point of exchange.

This evolutionary change results in some practical modifications: more attention is paid to the business logic and tools that are used for its development, language structures are automatically produced and checked by development environments and string-based logic is getting outdated and not enough efficient. Database query language is expected to follow the features of an object-oriented language: type-safe, easy to refactor and test. String-based languages like SQL, OQL, JDOQL do not meet these requirements. To fill this gap and provide developers with sufficient database query tools a new concept was developed by W.Cook and C. Rosenberger which was given a name Native Queries.

In the following paragraphs, we will review the concepts of Native Queries (NQ). We will use Pilot class for all examples suggested further:

Pilot.java
01/* Copyright (C) 2007 db4objects Inc. http://www.db4o.com */ 02package com.db4odoc.nqconcepts; 03 04public class Pilot { 05 private String name; 06 private int points; 07 08 public Pilot(String name, int points) { 09 this.name=name; 10 this.points =points; 11 } 12 13 public String getName() { 14 return name; 15 } 16 17 public int getPoints(){ 18 return points; 19 } 20}