[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] EclipseLink + storedprocedure
|
Hello
In my case I need to call a stored function.
I tried this:
@NamedStoredProcedureQuery(name="persistImageInfoIntoLibrary",
procedureName="IMAGE_API.CREATE_IMAGE",
procedureParameters={@StoredProcedureParameter(queryParameter="p_image_id"),
@StoredProcedureParameter(queryParameter="p_image_type_id"),
@StoredProcedureParameter(queryParameter="p_collection_id")}
)
DAO:
Query query =
getEntityManager().createNamedQuery("persistImageInfoIntoLibrary");
query.setParameter("p_image_id", 5);
query.setParameter("p_image_type_id", 200);
query.setParameter("p_collection_id", 99);
Object object = query.getSingleResult();
But I get the exception:
Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.0 (Build
SNAPSHOT - 20080409)): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00221: 'CREATE_IMAGE' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
The IMAGE_API.CREATE_IMAGE is a stored function, that returns an id.
What am I doing wrong?
Leon
Leon Derks wrote:
Hello
If I am correct there are two ways to call a stored procedure :
using entityManager.createNativeQuery();
Or
with the @NamedStoredProcedureQuery annotation.
Can someone provide me an example of how to call an oracle stored
procedure using the entityManager.createNativeQuery() method?
Leon
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users