Summary
Object-relational persistence layers offer the ability to retrieve objects from a database via an object-oriented query language. A recent IBM developerWorks tutorial by Murali Vivekanandan walks through an example of using the EJB Query Language in conjunction with Apache's Geronimo app server in constructing an online directory application.
Advertisement
The EJB Query Language, or EJB-QL, was introduced in EJB 2.0, and underwent a major upgrade in the EJB 3.0 specifications. Heavily inspired by popular Java-centeric O/R mapping frameworks, such as Hibernate and Kodo, EJB-QL allows developers to express complex relational queries in an object-oriented fashion.Murali Vivekanandan's recent IBM DeveloperWorks article, Geronimo Beans and the EJB Query Language [IBM developerWorks registration required*] provides a complete example, including downloadable code, of designing and building an online directory application with EJB-QL and the open-source Apache Geronimo app server.
The tutorial offers the following sections:
Defining Entity Beans
Defining a bean class
Setting up a database
Specifying the relationships
Finders with EJB QL
Introduction to finders
Implementing a finder
Implementing a session facade
Implementing a controller layer
Building and deploying on Geronimo
Using Finders
Building a finder with parameters
Implementing finders inside business methods
Summary, Resources, and Downloadable Code
* Note: Although we pointed to this item solely because we thought our audience would find it useful, Artima is currently running a program for IBM to drive registrations at DeveloperWorks.