Declaring the Deployment Descriptors

EJB QL enables you to traverse entity bean relationships. In this section, we discuss how to declare collection members in EJB QL and then present the full listing of the deployment descriptors.

Collection Member Declarations

In a one-to-many or a many-to-many relationship, the many side of the relationship consists of a collection of entity beans. You can declare a collection of values, in the FROM clause, using a collection member declaration. An identification variable of a collection member declaration is declared using the IN operator. For example, a finder method query to find all orders with pending line items can be written as follows:

 SELECT DISTINCT OBJECT(o) FROM Order AS o, IN(o.lineItems) as ...

Get Sams Teach Yourself EJB in 21 Days 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.