Jump to: navigation, search

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

Line 1: Line 1:
 
[[Category:EclipseLink/Example/JPA|StoredProcedures]]
 
[[Category:EclipseLink/Example/JPA|StoredProcedures]]
  
In addition to JPQL, EclipseLink defines a rich DatabaseQuery and Expression criteria API.
+
EclipseLink has extended support for stored procedure execution including:
 +
* IN, OUT and INOUT parameter support
 +
* CURSOR output parameter support
 +
* Result set support
 +
* Annotation support using @NamedStoredProcedureQuery
 +
* Dynamic definition support using [http://www.eclipse.org/eclipselink/api/2.2/org/eclipse/persistence/queries/StoredProcedureCall.html StoreProcedureCall]
 +
* Stored function support using StoredFunctionCall
 +
* Object-relational data-types, Struct, Array (OBJECT types, VARRAY), including mapping using ObjectRelationalDatatypeDescriptor
 +
* PLSQL types, BOOLEAN, RECORD, TABLE, using PLSQLStoredProcedureCall
  
See:
+
A stored procedure call be used in any query to read objects, or read or modify raw data.
* [http://www.eclipse.org/eclipselink/api/1.1/org/eclipse/persistence/queries/StoredProcedureCall.html StoredProcedureCall]
+
 
 +
Any CRUD or mapping operation can also be overridden using a stored procedure call using a DescriptorCustomizer and the DescriptorQueryManager API.
  
 
=== Oracle stored procedure using OUT CURSOR ===
 
=== Oracle stored procedure using OUT CURSOR ===

Revision as of 09:58, 1 February 2011


EclipseLink has extended support for stored procedure execution including:

  • IN, OUT and INOUT parameter support
  • CURSOR output parameter support
  • Result set support
  • Annotation support using @NamedStoredProcedureQuery
  • Dynamic definition support using StoreProcedureCall
  • Stored function support using StoredFunctionCall
  • Object-relational data-types, Struct, Array (OBJECT types, VARRAY), including mapping using ObjectRelationalDatatypeDescriptor
  • PLSQL types, BOOLEAN, RECORD, TABLE, using PLSQLStoredProcedureCall

A stored procedure call be used in any query to read objects, or read or modify raw data.

Any CRUD or mapping operation can also be overridden using a stored procedure call using a DescriptorCustomizer and the DescriptorQueryManager API.

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