EJB Query Language (EJB QL ) was introduced in the EJB 2.0 specification and enhanced in EJB 2.1 as a scheme for specifying the logic for finder and select methods on EJBs using container-managed persistence (CMP). As described in detail in Chapter 6, the CMP model in EJB 2.1 includes an abstract schema defined around your entity beans and their relationships, where beans become abstract tables, the CMP fields on the beans become abstract columns of sorts, and the relationships between beans act as abstract foreign key constraints. EJB QL allows you to specify queries based on this abstract schema, to be used by the container in the implementation of finder and select methods for your entity beans.
EJB QL is similar in syntax (naturally) to SQL, but is much simpler, since EJB QL needs to deal only with selecting beans and CMP fields from the abstract schema. EJB QL can’t be used to update or delete entity beans (the bean client interfaces are used for that), and it can’t be used to adjust the structure of the abstract schema. “Schema changes” are accomplished using the ejb-jar.xml deployment descriptor: new entity beans are defined, or unneeded ones are removed, and the deployment descriptor is adjusted to include/exclude these beans and define relationships between them. Full details on EJB deployment descriptors can be found in Appendix A, and some examples of their use are shown in Chapter 6.