[hibernate-issues] [JIRA] (HHH-13805) Dialect is not autodetected on Sql Server 2014 with custom INT sequences

Manuel Mall (JIRA) jira at hibernate.atlassian.net
Tue Apr 28 21:20:12 EDT 2020


Manuel Mall ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A453d3165-e576-490d-adc5-01c4d5bb64df ) *commented* on HHH-13805 ( https://hibernate.atlassian.net/browse/HHH-13805?atlOrigin=eyJpIjoiMTMzYTFiNzVmMWNkNDQ0NmE5ZGUzOGRlNmIwYjk2OGMiLCJwIjoiaiJ9 )

Re: Dialect is not autodetected on Sql Server 2014 with custom INT sequences ( https://hibernate.atlassian.net/browse/HHH-13805?atlOrigin=eyJpIjoiMTMzYTFiNzVmMWNkNDQ0NmE5ZGUzOGRlNmIwYjk2OGMiLCJwIjoiaiJ9 )

I don’t agree with the assessment that this is a bug in the Microsoft JDBC driver. There is no requirement for a driver to automatically cast results. The problem is that SQL Server sequences are typed and can be of any integer type ( https://docs.microsoft.com/en-us/sql/t-sql/statements/create-sequence-transact-sql?view=sql-server-ver15 ). That is reflected in the types of the values returned when querying the schema (INFORMATION_SCHEMA.SEQUENCES). The type of value returned by the columns holding the min, max, and start sequence values reflects the type of the sequence as they are of type sql_variant. However, Hibernate assumes it always returns a Long which is an incorrect assumption. I recently had to deal with the issue and wrote a small custom dialect that works around the issue.

See also: https://discourse.hibernate.org/t/java-lang-classcastexception-java-math-cannot-be-cast-to-java-lang-long-while-starting-server/4074 and https://discourse.hibernate.org/t/sql-server-could-not-fetch-the-sequenceinformation-from-the-database/4083

( https://hibernate.atlassian.net/browse/HHH-13805#add-comment?atlOrigin=eyJpIjoiMTMzYTFiNzVmMWNkNDQ0NmE5ZGUzOGRlNmIwYjk2OGMiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13805#add-comment?atlOrigin=eyJpIjoiMTMzYTFiNzVmMWNkNDQ0NmE5ZGUzOGRlNmIwYjk2OGMiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100125- sha1:29f7b81 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200429/4b2ec00f/attachment.html 


More information about the hibernate-issues mailing list