Another thing that comes up is parameters and native queries. In native
queries, all 3 forms are valid: named, jpa-ordinal and jdbc-style.
Again historically all positional (jdbc-style) parameters are zero-based.
This open up the problem of different bases depending on whether jpa-style
or jdbc-style is used. E.g.
session.createNativeQuery( "... where a.name = ?" ).setParameter( 0,
"Steve" );
session.createNativeQuery( "... where a.name = ?1" ).setParameter( 1,
"Steve" );
To me its a bit odd to have these different bases. I understand that
because they are different "parameter strategies" it is easy enough to
explain to a user the difference. But I wonder if that is something we
should make consistent to just always assume an ordinal base of 1, i.e.:
session.createNativeQuery( "... where a.name = ?" ).setParameter( 1,
"Steve" );
session.createNativeQuery( "... where a.name = ?1" ).setParameter( 1,
"Steve" );
The only down side to this is yet another upgrade concern for users.
Thoughts?
On Fri, Nov 17, 2017 at 12:15 PM Sanne Grinovero <sanne(a)hibernate.org>
wrote:
+1 I see no problem either.
On 17 November 2017 at 15:57, Steve Ebersole <steve(a)hibernate.org> wrote:
> Actually its possible that the TCK always tested it and merging
> `javax.persistence.Query` and `org.hibernate.query.Query` may be the
> culprit. But either way, the net result is the same...
>
> On Fri, Nov 17, 2017 at 8:44 AM Steve Ebersole <steve(a)hibernate.org>
wrote:
>
>> I wont bore everyone with the history here, but long story short is that
>> we need to start treating JPA "positional" parameters as positional
in
the
>> `javax.persistence.Parameter#getPosition` sense. Even though there is
>> nothing positional about JPA's positional parameters, this has moved
from a
>> philosophical discussion to a practical one as the JPA 2.2 TCK is
testing
>> this, whereas older ones did not
>>
>> To do that however, we need to drop our older positional parameter
>> support. That feature has been deprecated for quite some time now.
Unless
>> there are objections, I will plan on dropping that in 5.3
>>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/hibernate-dev