Sounds like a good solution to me.
-Patrick
On 10/17/07, Kevin Sutter <[EMAIL PROTECTED]> wrote:
> Hi,
> One of our customers stumbled over this error message when parsing a
> @NamedNativeQuery:
>
> bad-param-name: The parameter name or position "{0}" passed to \
> execute() is not valid. All map keys must be a declared parameter \
> name or a number matching the parameter position.
>
> The @NamedNativeQuery was as follows:
>
> @NamedNativeQuery(name="getStationKeyForUpdate",
> query="SELECT * from KEYGEN where KEYNAME = :keyname FOR UPDATE")
>
> Native Queries only allow positional parameters. This customer thought that
> the error message should be clearer since it mentions that named parameters
> may also be allowed.
>
> I looked at the code in question and we use the same processing for named
> and positional parameter for both jpql and native queries. So, it would be
> overkill (in my mind) to separate out the processing just to clarify the
> syntax requirements of the various queries.
>
> So, would there be any problem with just adding the following to the error
> message:
>
> bad-param-name: The parameter name or position "{0}" passed to \
> execute() is not valid. All map keys must be a declared parameter \
> name or a number matching the parameter position. Native queries \
> only allow positional parameters.
>
> It clarifies the problem without introducing a lot of extra processing.
>
> Kevin
>
--
Patrick Linskey
202 669 5907