Using EclipseLink, you can express a query using the following query languages:
SQL Queries
EclipseLink Expressions (see Chapter 11, "Understanding EclipseLink Expressions")
In most cases, you can compose a query directly in a given query language or, preferably, you can construct a DatabaseQuery
with an appropriate Call
and specify selection criteria using an Expression
object. Although composing a query directly in SQL appears to be the simplest approach (and for simple operations or operations on unmapped data, it is), using the DatabaseQuery
approach offers the compelling advantage of confining your query to your domain object model and avoiding dependence on data source schema implementation details.
Oracle recommends that you compose your queries using Expression
.
SQL is the most common query language for applications that use a relational database data source.
You can execute custom SQL directly using Session
methods executeSelectingCall
and executeNonSelectingCall
, or you can construct a DatabaseQuery
with an appropriate Call
.
EclipseLink provides a variety of SQL Call
objects for use with stored procedures and, with Oracle Database, stored functions.
EclipseLink also supports PL/SQL call for Oracle stored procedures with PL/SQL data types.