Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/JPA/StoredProcedures"

m (New page: por favor)
 
Line 1: Line 1:
por favor
+
[[Category:EclipseLink/Example/JPA|StoredProcedures]]
 +
 
 +
In addition to JPQL, EclipseLink defines a rich DatabaseQuery and Expression criteria API.
 +
 
 +
See:
 +
* [http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/queries/StoredProcedureCall.html StoredProcedureCall]
 +
 
 +
=== Oracle stored procedure using OUT CURSOR ===
 +
<source lang="sql">
 +
</source>
 +
 
 +
=== Using JpaEntityManager createQuery() API to execute a stored procedure ===
 +
<source lang="java">
 +
import javax.persistence.Query;
 +
import org.eclipse.persistence.queries.StoredProcedureCall;
 +
import org.eclipse.persistence.queries.ReadAllQuery;
 +
 
 +
ReadAllQuery databaseQuery = new ReadAllQuery(Employee.class);
 +
StoredProcedureCall call = new StoredProcedureCall();
 +
 
 +
Query query = ((JpaEntityManager)entityManager.getDelegate()).createQuery(databaseQuery);
 +
List result = query.getResultList();
 +
 
 +
</source>
 +
 
 +
=== Using @NamedStoredProcedureQuery to define a stored procedure ===
 +
<source lang="java">
 +
</source>

Revision as of 10:50, 1 February 2011


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

See:

Oracle stored procedure using OUT CURSOR

 

Using JpaEntityManager createQuery() API to execute a stored procedure

import javax.persistence.Query;
import org.eclipse.persistence.queries.StoredProcedureCall;
import org.eclipse.persistence.queries.ReadAllQuery;
 
ReadAllQuery databaseQuery = new ReadAllQuery(Employee.class);
StoredProcedureCall call = new StoredProcedureCall();
 
Query query = ((JpaEntityManager)entityManager.getDelegate()).createQuery(databaseQuery);
List result = query.getResultList();

Using @NamedStoredProcedureQuery to define a stored procedure

 

Back to the top