I ended up changing the default to 1 for consistency, but adding a setting `hibernate.query.sql.jdbc_style_params_base` upgrading users can use temporarily.
On Mon, Nov 20, 2017 at 4:01 AM andrea boriero <and...@hibernate.org> wrote: > I would prefer consistency, but as you pointed out this for users will be > another upgrade concer , so may be for a 5.3 it is better to mantain the > zero-based style. > > On 18 November 2017 at 19:18, Steve Ebersole <st...@hibernate.org> wrote: > >> 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 <sa...@hibernate.org> >> wrote: >> >> > +1 I see no problem either. >> > >> > >> > On 17 November 2017 at 15:57, Steve Ebersole <st...@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 <st...@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@lists.jboss.org >> > > https://lists.jboss.org/mailman/listinfo/hibernate-dev >> > >> _______________________________________________ >> hibernate-dev mailing list >> hibernate-dev@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/hibernate-dev >> > > _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev