jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: stored procedures

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Fri, 08 Apr 2011 13:09:40 -0700

Hi Rainer,

We were assuming that result sets that were returned via the REF_CURSOR
parameter mechanism would be handled as such by the provider, and would be
returned by JPA after "normal" result sets in the order in which they
were defined. The resultClass or resultSetMapping metadata supplied
for the stored procedure query would reflect this order. So I don't think
we would need the metadata to be associated with the parameter.

best regards,

-Linda


On 4/8/2011 8:28 AM, Rainer Kwesi Schweigkoffer wrote:
> Hi Linda, all,
>
> Linda DeMichiel, am 31 Mar 2011 hast Du um 17:46 zum Thema "[jsr338-experts] stored procedures" geschrieben :
>
>> @Target(value={})
>> @Retention(value=RUNTIME)
>> public @interface StoredProcedureParameter {
>> String name default "";
>> ParameterMode mode default ParameterMode.IN;
>> Class type;
>> }
>>
>>
>> public enum ParameterMode {
>> IN,
>> INOUT,
>> OUT,
>> REF_CURSOR
>> }
>>
>> REF_CURSOR is used to specify the case where a result set is returned
>> via an output parameter that is of a cursor variable type. This is
>> needed for databases that support returning ref cursors as output
>> parameters.
>
> We will need a
>
> String resultSetMapping default "";
>
> attribute within @StoredProcedureParameter then for ParameterMode
> REF_CURSOR, won't we ?
>
>
>> /*
>> * When using parameter names, all parameters must be registered in
>> * the order in which they occur in the parameter list of the
>> * stored procedure
>> */
>> public StoredProcedureQuery registerStoredProcedureParameter(
>> String parameterName,
>> Class type,
>> ParameterMode mode);
>>
>> public StoredProcedureQuery registerStoredProcedureParameter(
>> int position,
>> Class type,
>> ParameterMode mode);
>
> And consequently
>
> registerStoredProcedureCursorParameter(
> int position resp. String parameterName,
> String resultMapping)
>
>>> The getOutputParameterValue methods are used to retrieve the values
>> passed back from the procedure through INOUT and OUT parameters.
>>
>> Object getOutputParameterValue(int position)
>>
>> Object getOutputParameterValue(String parameterName)
>
> Would you expect the result sets resulting from REF_CURSOR parameters
> be appended to the result sets returned by the query (in which case
> registerStoredProcedureCursorParameter should return the
> StoredProcedureQuery, I think) or to be retrieved via a special
> getCursorParameterValue method (in which case I'd rather see something
> like Parameter<Tuple> as return value of
> registerStoredProcedureCursorParameter) ?
>
> Best regards
> Rainer
>
> ---
> Rainer Schweigkoffer SAP AG Walldorf
> Business Solution & Technology TD Core JS&I
> Technology Development Dietmar-Hopp-Allee 16
> Java Server Core D-69190 Walldorf
> JEE Implementation Group phone: +49 6227 7 45305
> Building 3, I.3.14 fax: +49 6227 7 821177
> rainer.schweigkoffer_at_sap.com
>
> Sitz der Gesellschaft/Registered Office: Walldorf, Germany
> Vorstand/SAP Executive Board: Werner Brandt, Angelika Dammann,
> Bill McDermott (Co-CEO), Gerhard Oswald, Vishal Sikka,
> Jim Hagemann Snabe (Co-CEO)
> Vorsitzender des Aufsichtsrats/Chairperson of the SAP Supervisory
> Board: Hasso Plattner
> Registergericht/Commercial Register Mannheim No HRB 350269
>
> Diese E-Mail kann Betriebs- oder Geschaeftsgeheimnisse oder sonstige
> vertrauliche Informationen enthalten. Sollten Sie diese E-Mail
> irrtuemlich erhalten haben, ist Ihnen eine Verwertung des Inhalts,
> eine Vervielfaeltigung oder Weitergabe der E-Mail ausdruecklich
> untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die
> empfangene E-Mail. Vielen Dank.
>
> This e-mail may contain trade secrets or privileged, undisclosed, or
> otherwise confidential information. If you have received this e-mail
> in error, you are hereby notified that any review, copying, or
> distribution of it is strictly prohibited. Please inform us
> immediately and destroy the original transmittal. Thank you for your
> cooperation.
>
>