EJB QL, as many know is the acronym for Enterprise Java Beans Querying Language.Many of us know how to use them.Here I am just trying to explain the fundamental components of it.
Sun Microsystems’s EJB 1.1 specification doesn’t offer a standard way to define queries for finder methods in Entity Beans with CMP. To address this EJB QL was introduced with EJB 2.0.
In EJB1.1 developers have to redefine queries for the finder methods whenever an application is moved from one vendor’s application server to another’s. This makes applications built using CMP less portable and also not scaleable.
Moreover, EJB 1.1 do not address how to define a query for an Entity bean with CMP to navigate with other Entity beans in relationships, or associations. Also nothing was specified how to have queries to access from one entity bean to its dependent classes and the member variables of those dependent classes.
EJB 2.0 deals with these shortcomings by defining the EJB Query Language. It is based on the SQL-92 specification for defining various finder() and select() methods of Entity beans with CMP. The EJB QL query string consists of three clauses: SELECT, FROM, and WHERE. Among other things, EJB QL offers a standard way to define relationships between entity beans and dependent classes by introducing abstract schema types and relationships in the deployment descriptor file.
h4. Components of EJB QL :-
The following syntax is the basic format of the EJB QL query: