[ Team LiB ] Previous Section Next Section

WebLogic Query Language

EJB Query Language (EJB-QL) is a query language that defines finder methods for 2.0 Entity beans with container-managed persistence. The deployment descriptors must define each finder query for Entity beans by using an EJB-QL query string.

NOTE

If you're interested in learning EJB-QL in detail, please visit http://www.ejb-ql.com.


In WebLogic, you can use the WebLogic QL to query EJB objects instead of the standard EJB-QL that's defined in the ejb-jar.xml file. WebLogic QL is defined in the weblogic-cmp-rdbms-jar.xml file. The values for the finder queries in the WebLogic-specific deployment descriptors override the values specified in the standard J2EE deployment descriptors.

The main advantage of using the WebLogic QL is that it's richer in features than the standard EJB-QL. That includes features such as aggregate functions, subqueries, and the Order By clause.

  • Aggregate functions— The WebLogic QL enables developers to use MIN, MAX, AVG, SUM, and COUNT. The aggregate functions behave like SQL functions. They're evaluated over the range of the beans returned by the WHERE conditions of the query.

  • Subqueries— The relationship between WebLogic QL and subqueries is similar to the relationship between SQL queries and subqueries. Use WebLogic QL subqueries in the WHERE clause of the WebLogic QL query. The depth of these subqueries is whatever the database supports.

  • Order By clause— The Order By clause specifies a mechanism to order the results of the queries. Sorting is done at the database layer as part of the SQL query.

We've covered all the basic concepts of Entity beans and their usage in the context of WebLogic. Let's now talk about some WebLogic Server 8.1–specific EJB features and enhancements with respect to Entity beans.

    [ Team LiB ] Previous Section Next Section