jsr338-experts@jpa-spec.java.net

[jsr338-experts] Re: stored procedures

From: Rainer Kwesi Schweigkoffer <kwesi_at_sap.com>
Date: Fri, 08 Apr 2011 16:47:01 +0200

Hi Matthew, all,

Matthew Adams, am 8 Apr 2011 hast Du um 9:15 zum Thema "[jsr338-experts] Re: stored procedures" geschrieben :

> I haven't fully thought this through, but is there a way to provide
> more type safety to the methods
>
> Object getOutputParameterValue(int position)
> Object getOutputParameterValue(String parameterName)
>
> on StoredProcedureQuery? Any other methods where generics could be used?

Me, on the contrary, I was wondering about the meaning of

<T> StoredProcedureQuery setParameter(Parameter<T> param, T value)

which we inherit from Query. Could I use the

<T> ParemeterExpression<T> parameter(Class<T> paramClass, String name)

method of CriteriaBuilder to get a Parameter<T> object and set a stored
procedure parameter with it based on name identity ? What about a
Parameter<T> object without name and position as obtained from

<T> ParemeterExpression<T> parameter(Class<T> paramClass)

This brought me to the idea that we might want to consider changing the
return type of the register methods

<T> Parameter<T> registerStoredProcedureParameter(
          int position,
          Class<T> type,
          ParameterMode mode)

<T> Parameter<T> registerStoredProcedureParameter(
          String parameterName,
          Class<T> type,
          ParameterMode mode)

which would enable us to add a method

<T> <T> getOutputParameterValue(Parameter<T> param)

We could then say that the usage of a Parameter<T> object other than
the ones created by one of the register methods is undefined for a
certain StoredProcedure.

What do you think ?

Kind 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.