-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Dialect is not autodetected on Sql Server 2014 with custom INT sequences #19579
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
@40305561 If that works when you set the database platform, this is likely to be a Hibernate issue. What version did you use that worked and what version was selected when the property was not set? |
@snicoll I manually choose SQLServer2012Dialect, this is also detected by hibernate but doesn't finish because of the Integer to Long class cast exception. |
@40305561 Sorry I don't understand. In your original description you're stating that "it only happens when the platform is set" which led me to believe that something was detecting the wrong dialect. Can you please clarify? Sharing a small sample that reproduces the issue would be idea (a zip or github repo of a project we can run ourselves). |
@snicoll It only happens when the platform is NOT set. |
I added a minimal demo project. |
Thanks for the sample. This helps me making sure that there isn't anything else going on in the project and the version of Spring Boot you're using.
Yes, sorry about that. If the platform is not set, Hibernate is deciding which dialect to use. If that doesn't work, then it is very much likely to be a Hibernate issue. I fail to see, based on your sample, what it could be and how Spring Boot participates in your issue. Can you please double check that the dialect are the same when the platform is set and when it is not set? |
Yes the dialects are the same when the platform is set and when it is not set (in both cases SQLServer2012Dialect), also the old spring boot dialect discovery (before it switched to hibernate dialect discovery in 2.2) recognized SQLServer2012Dialect. Do you now how to submit a Hibernate Issue? I know what goes wrong in the Hibernate Code, but my hibernate knowledge is very limited. |
@40305561 thanks for the feedback. The Hibernate issue tracker is on Jira. I am going to close this issue now, we can reopen if it turns out to be an issue in Spring Boot after all. |
Created a hibernate issue: https://hibernate.atlassian.net/browse/HHH-13805 |
See issue #16172
Dialect is not detected when a Microsoft Sql Server 2014 database is used in combination with custom sequences of INT type.
The sequence was created the following way: create sequence example as INT start with 42 increment by 1 no cache
This occurs only if jpa.database-platform is not set.
Spring Boot 2.2.2 with Java 8 and mssql-jdbc 7.4.1.jre8 is used.
Spring Boot Exception: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
After debugging I found out that hibernates SequenceInformationExtractorLegacyImpl#extractMetadata fails.
This is caused because in SequenceInformationExtractorLegacyImpl#resultSetStartValueSize() it calls resultSet.getLong()
which fails with 'java.lang.Integer' to 'java.lang.Long' exception from the Microsoft Jdbc driver (SqlServerResultSet#getLong(String))
The text was updated successfully, but these errors were encountered: