EJB QL

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.