EJB QL

From Wikipedia, the free encyclopedia
Jump to: navigation, search

EJB QL or EJB-QL is a portable database query language for Enterprise Java Beans. It was used in Java EE applications. Compared to SQL, however, it is less complex but less powerful as well.[1]

History[edit]

The language has been inspired, especially EJB3-QL, by the native Hibernate Query Language HQL.[2]

In EJB3 It has been mostly replaced by the Java Persistence Query Language.

Differences[edit]

EJB QL is a database query language similar to SQL. The used queries are somewhat different from relational SQL, as it uses a so-called "abstract schema" of the enterprise beans instead of the relational model. In other words, EJB QL queries do not use tables and their components, but enterprise beans, their persistent state, and their relationships. The result of an SQL query is a set of rows with a fixed number of columns. The result of an EJB QL query is either a single object, a collection of entity objects of a given type, or a collection of values retrieved from CMP fields. One has to understand the data model of enterprise beans in order to write effective queries.[3]

See also[edit]

References[edit]

  1. ^ See the Introduction (p. 4) of »expert one-on-one: J2EE Design and Development«, (c) 2002 wrox press.
  2. ^ Chapter 7. EJB-QL: The Object Query Language
  3. ^ "ADVANCED EJB QL: SQL vs. EJB QL: Relational and Object Query Languages". Archived from the original on 2008-05-13.