-
Notifications
You must be signed in to change notification settings - Fork 41.1k
After migrate 1.4.3 release to 1.5.1 release, sql server throw an exception when paging #8253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @fcjxxl ! |
@martin-g I am sorry to tell you that the Hibernate version in 1.4.3 and 1.5.1 is exactly the same: 5.0.11.Final |
Several things here Do you get Could you please try with A sample that reproduces the problem would be ideal. Also, please double check you're using the same Hibernate version. |
Hi @snicoll , I tried with 1.5.2.BUILD-SNAPSHOT, but still met the same problem. |
sql-server-paging-demo.zip PS: I add the sql server dependency manually by install:install-file -Dfile=sqljdbc42.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc -Dversion=4.2, you just remove the sql server dependency in pom.xml and add the sqljdbc42.jar to classpath. |
After quick inspection it turns out that for some still to be determined reason, Boot 1.5 bootstraps Hibernate with |
@olivergierke Thank you for your advice. I add |
@olivergierke thanks for looking into it. @fcjxxl thanks for confirming. I'll investigate why the dialect detection has changed. |
What I am suspecting is that Hibernate chooses a different default depending on whether we don't hand it anything at all VS. when we sort of detect the database from the JDBC URL and thus hand |
OK so that's a side effect of #7708 - In 1.4, the On paper, it looks all good. Except there are several dialects for SQL Server... Not sure what to do here. |
I've created SPR-15255 to discuss what we could do on the framework's side of things. |
Most of the supported databases have several dialects. We're setting the latest dialect variants there in Spring Framework 5.0 already, but 4.3.x hasn't been updated due to its Hibernate 3.6-5.2 support constraints. SQL Server 2000 is really outdated though, we need to update that one. I wasn't aware that Hibernate is doing smart autodetection for specific SQL Server versions in general. Why is it picking 2008 specifically when there's 2012 as well? Also, why wasn't Hibernate's own detection able to figure out the cases that your #7708 enhancement meant to cover? |
All I got from @olivergierke is that "It doesn't do for all databases.". I'd argue that if Hibernate does some smart detection for certain dialects, we shouldn't set it ourselves. I don't know if that's documented. |
@fcjxxl just to be sure, could you please also try with |
I've updated the doc and the release notes. Also |
@snicoll Hi, I tried with
|
Thanks for testing! The reason why it doesn't work is because I am an idiot. I meant to write |
I use @PageableDefault in controller for pagination, like this:
@PageableDefault(value = 20, sort = { "id" }, direction = Direction.DESC) Pageable pageable
in 1.4.3 it runs without problems, when migrate to 1.5.1, it throws an exception as follows:
Then I compared the two SQL statements in 1.4.3 & 1.5.1, find out the difference:
Hibernate: select TOP(?) patient0_.pat_id as pat_id1_15_...... ----1.4.3
Hibernate: select TOP ? patient0_.pat_id as pat_id1_15_....... ----1.5.1
Is the lack of "()" cause the exception?
The text was updated successfully, but these errors were encountered: