EJB Query Language (EJB QL) was introduced in the EJB 2 specification to make CMP Entity beans more portable across EJB containers. Previously, each EJB container vendor created their own proprietary mechanism for specifying the semantics of finder methods. This is no longer the case.

As a language, EJB QL is based on ANSI SQL and bears some similarity with the Object Constraint Language (OCL) that is part of UML.

Syntax and Examples

The EJB Specification formally defines the syntax of EJB QL queries using Bacchus Normal Form (BNF). This can be somewhat heavy to wade through, but is comprehensive. Rather than reproduce the specification (and to keep things simple), this section introduces EJB QL using examples. You should refer to the ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.