Skip to main content
Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/JPA/Basic JPA Development/Querying/Native"

m (EclipseLink Native Query)
m (EclipseLink Native Query)
Line 5: Line 5:
*[ org.eclipse.persistence.queries]
*[ org.eclipse.persistence.expressions]
For additional information on EclipseLink native queries, see [[EclipseLink/UserGuide/Queries_(ELUG)|Queries]] in the ''EclipseLink User's Guide''.
* [ org.eclipse.persistence.queries]
* [ org.eclipse.persistence.expressions]
* [[EclipseLink/UserGuide/Queries_(ELUG)|Queries]] in the ''EclipseLink User's Guide''
=== Using JpaEntityManager createQuery() API ===
=== Using JpaEntityManager createQuery() API ===

Revision as of 13:48, 16 June 2010

EclipseLink Native Query

In addition to JPQL, EclipseLink rich native DatabaseQuery and Expression criteria API.

Elug api package icon.png Key API {{{apis}}}

For additional information on EclipseLink native queries, see Queries in the EclipseLink User's Guide.

Using JpaEntityManager createQuery() API

import javax.persistence.Query;
import org.eclipse.persistence.expressions.*;
import org.eclipse.persistence.queries.ReadAllQuery;
ExpressionBuilder builder = new ExpressionBuilder();
ReadAllQuery databaseQuery = new ReadAllQuery(Employee.class, builder);
Query query = ((JpaEntityManager)entityManager.getDelegate()).createQuery(databaseQuery);
List result = query.getResultList();

Elug note icon.png

Note: The JpaEntityManager API was added in EclipseLink 1.1.

In EclipseLink 1.0, the JpaQuery method setDatabaseQuery() could be used.

Version: DRAFT
Other versions...

Back to the top