Skip Headers

# Using EJB QL Calls

Previous

Next

The TopLink expression framework lets you define complex queries at the object level. Alternatively, you can specify a custom EJB QL string in an EJB QL `Call` object and provide that `Call` object to any query.

You can also specify an EJB QL string directly in a `DatabaseQuery`. For more information, see "Specifying a Custom EJB QL String in a DatabaseQuery".

You can provide an `EJBQLCall` object to any query instead of an expression or EJB QL string, but the procedure must return all data required to build an instance of the class you query.

You can invoke EJB QL queries through the session query methods or through a `DatabaseQuery`.

Session Read Query With Custom EJB QL

    Vector theObjects = (Vector)aSession.readAllObjects(
        EmployeeBean.class,
        new EJBQLCall("SELECT OBJECT (emp) from EmployeeBean emp"));