Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » How to get return code from a stored procedure using EclipseLink (NamedStoredProcedureQuery Annotation)
How to get return code from a stored procedure using EclipseLink [message #723621] Thu, 08 September 2011 21:23 Go to previous message
Sridhar Baratam is currently offline Sridhar Baratam
Messages: 22
Registered: September 2011
Junior Member
Hi Gurus,

I am trying to execute a stored procedure using EclipseLink NamedStoredProcedureQuery. Can someone help me to get the return code from the storedprocedure?

For example, the stored procedure will be something like:

*********************************************************************************
create procedure get_person
@person_name varchar(80)

as
declare @machine_type char(1)

IF @person_name = 'ALL' BEGIN
SELECT ID, NAME, SURNAME, ADDRESS
FROM Person
WHERE NAME > ''
ORDER BY NAME
END
ELSE BEGIN
IF exists (SELECT NAME FROM Person WHERE NAME = @person_name)
SELECT ID, NAME, SURNAME, ADDRESS
FROM Person
WHERE NAME = @person_name
ORDER BY NAME
END
return -999 /*SUCCESS*/
*********************************************************************************

The NamedStoredProcedureQuery Annotation only allows you to set the StoredProcedureParameter list but it does not allow to capture the return code from the stored procedure. In the above example, how do I capture the return code -999?

If I call using the sql92 convention {? = call get_person(?)} using a callable statement, I am able to get the return code succesfully. I would like to use EclipseLink's NamedStoredProcedureQuery Annotation for practical purposes.


Thanks
Sridhar
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Strange cache behaviour after clear
Next Topic:DescriptorQueryManager+EntityManager
Goto Forum:
  


Current Time: Fri May 24 07:02:05 EDT 2013

Powered by FUDForum. Page generated in 0.01862 seconds