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 See attached sample project (just execute NativeApiIllustrationTest). You need an Sql Server database with the mentioned sequence in it. This is the relevant log: WARN: HHH000342: Could not obtain connection to query metadata : java.lang.Integer cannot be cast to java.lang.Long 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)) See also the issue I created on spring boot (https://github.com/spring-projects/spring-boot/issues/19579) |