Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » IN_OUT Parameters not working for NamedStoredProcedureQuery
IN_OUT Parameters not working for NamedStoredProcedureQuery [message #541635] Mon, 21 June 2010 21:14 Go to next message
Mark Robinson is currently offline Mark Robinson
Messages: 6
Registered: June 2010
Junior Member
I'm trying to use NamedStoredProcedureQuery with IN_OUT parameters.

I have found that if I pass in either null or "" as the value for my IN_OUT then I will get a message returned in the parameter. However if I pass in, say "0", then I will get "0" as a my returned value. Not exactly the results I was hoping for.

Here is the NamedStoredProcedureQuery, am I doing anything wrong?

@NamedStoredProcedureQuery(name = "ADD_ENROLMENT", procedureName = "pkg_enrolment.add_enrolment",
									returnsResultSet = false,
									parameters = {

@StoredProcedureParameter(queryParameter = "p_enrolment_id", name = "p_enrolment_id", direction = Direction.IN, type=String.class),
@StoredProcedureParameter(queryParameter = "p_v3id", name = "p_v3id", direction = Direction.IN, type=String.class),
@StoredProcedureParameter(queryParameter = "p_v3plan", name = "p_v3plan", direction = Direction.IN,  type=String.class),								  @StoredProcedureParameter(queryParameter = "p_v3careercreatedate", name = "p_v3careercreatedate", direction = Direction.IN,  type=Date.class),
@StoredProcedureParameter(queryParameter = "p_spouseid", name = "p_spouseid", direction = Direction.IN_OUT, type=String.class),
@StoredProcedureParameter(queryParameter = "out_errormsg", name = "out_errormsg", direction = Direction.IN_OUT,  type= String.class)}


EDIT - Formatting of code to be more readable

[Updated on: Tue, 22 June 2010 16:09]

Report message to a moderator

Re: IN_OUT Parameters not working for NamedStoredProcedureQuery [message #541824 is a reply to message #541635] Tue, 22 June 2010 16:05 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1026
Registered: July 2009
Senior Member
Hello,

Have you tried defining the paramater using Direction.IN_OUT, or was that just a mistake in posting?

Best Regards,
Chris
Re: IN_OUT Parameters not working for NamedStoredProcedureQuery [message #541825 is a reply to message #541824] Tue, 22 June 2010 16:07 Go to previous messageGo to next message
Mark Robinson is currently offline Mark Robinson
Messages: 6
Registered: June 2010
Junior Member
Hi Chris,

The parameters
p_spouseid
and
out_errormsg
are defined as IN_OUT and those are the ones I am trying to use.

So I pass out_errormsg as "" then I will get an error string but if I pass it in as "0" then I will not get an error string.
Re: IN_OUT Parameters not working for NamedStoredProcedureQuery [message #541848 is a reply to message #541635] Tue, 22 June 2010 17:37 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Sounds like something is going wrong in your JDBC driver. Try the same through raw JDBC, do you get the same result. Check that your stored procedure is working correctly as well.

What database are you using? Maybe change it to an OUT instead of an IN_OUT.



James : Wiki : Book : Blog : Twitter
Re: IN_OUT Parameters not working for NamedStoredProcedureQuery [message #541886 is a reply to message #541848] Tue, 22 June 2010 22:44 Go to previous message
Mark Robinson is currently offline Mark Robinson
Messages: 6
Registered: June 2010
Junior Member
Thanks James,

It turns out my problem was procedure wasn't changing my parameters as I had expected.
Previous Topic:Criteria API + countDistinct + composite primary key
Next Topic:Static Weaving through Eclipse Plug-in
Goto Forum:
  


Current Time: Thu Oct 02 08:36:39 GMT 2014

Powered by FUDForum. Page generated in 0.01689 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software