SQLServerDialect using DATEDIFF_BIG when comparing days

Description

The documentation of the SQLServerDialect class says it works for SQL Server 2008 and above, however it utilizes DATEDIFF_BIG which is only available in SQL Server 2016 and above. See MS docs here.

Our application has a JPA Query using DATEDIFF which is translated to DATEDIFF_BIG by the SQLServerDialect.

The DATEDIFF in our case is comparing days, I see no reason why we should compare days using DATEDIFF_BIG.

This is quite a large issue for us, since one of our customers is still using SQL Server 2012 and now unable to open the dashboard without encountering an error due to the exception cause by this issue.

Activity

Show:

Christian Beikov September 8, 2023 at 4:03 PM

Thanks for the report. We will look into it as soon as possible. Unfortunately we have no way of testing databases that are this old, so even though we try to retain compatibility with SQL Server 2008, it is at this point just best effort. The oldest version we regularly test with is SQL Server 2017, since that is the oldest version for which a docker image is available.

If you want to improve the situation for SQL Server 2008 compatibility, please consider running the Hibernate testsuite against your local SQL Server 2008 instance and report the test failures you are seeing. We will look into these failures.

Details

Assignee

Reporter

Components

Sprint

Affects versions

Priority

Created September 8, 2023 at 12:08 PM
Updated February 26, 2024 at 3:40 PM