22 * SPDX-License-Identifier: Apache-2.0
33 * Copyright Red Hat Inc. and Hibernate Authors
44 */
5- package org .hibernate .dialect ;
5+ package org .hibernate .community . dialect ;
66
77import org .hibernate .LockOptions ;
8+ import org .hibernate .dialect .DatabaseVersion ;
9+ import org .hibernate .dialect .Dialect ;
10+ import org .hibernate .dialect .FunctionalDependencyAnalysisSupport ;
11+ import org .hibernate .dialect .FunctionalDependencyAnalysisSupportImpl ;
12+ import org .hibernate .dialect .MySQLDialect ;
13+ import org .hibernate .dialect .MySQLServerConfiguration ;
814import org .hibernate .dialect .aggregate .AggregateSupport ;
915import org .hibernate .dialect .aggregate .MySQLAggregateSupport ;
1016import org .hibernate .dialect .sequence .SequenceSupport ;
11- import org .hibernate .dialect .sequence .TiDBSequenceSupport ;
17+ import org .hibernate .community . dialect .sequence .TiDBSequenceSupport ;
1218import org .hibernate .engine .jdbc .dialect .spi .DialectResolutionInfo ;
1319import org .hibernate .engine .spi .SessionFactoryImplementor ;
1420import org .hibernate .query .sqm .IntervalType ;
1824import org .hibernate .sql .ast .spi .StandardSqlAstTranslatorFactory ;
1925import org .hibernate .sql .ast .tree .Statement ;
2026import org .hibernate .sql .exec .spi .JdbcOperation ;
21- import org .hibernate .tool . schema . extract . internal .SequenceInformationExtractorTiDBDatabaseImpl ;
27+ import org .hibernate .community . dialect . sequence .SequenceInformationExtractorTiDBDatabaseImpl ;
2228import org .hibernate .tool .schema .extract .spi .SequenceInformationExtractor ;
2329
2430import jakarta .persistence .TemporalType ;
@@ -43,7 +49,7 @@ public TiDBDialect(DatabaseVersion version) {
4349 }
4450
4551 public TiDBDialect (DialectResolutionInfo info ) {
46- super ( createVersion ( info ), MySQLServerConfiguration .fromDialectResolutionInfo ( info ) );
52+ super ( createVersion ( info , MINIMUM_VERSION ), MySQLServerConfiguration .fromDialectResolutionInfo ( info ) );
4753 registerKeywords ( info );
4854 }
4955
@@ -62,19 +68,19 @@ protected DatabaseVersion getMinimumSupportedVersion() {
6268 protected void registerDefaultKeywords () {
6369 super .registerDefaultKeywords ();
6470 // TiDB implemented 'Window Functions' of MySQL 8, so the following keywords are reserved.
65- registerKeyword ("CUME_DIST" );
66- registerKeyword ("DENSE_RANK" );
67- registerKeyword ("EXCEPT" );
68- registerKeyword ("FIRST_VALUE" );
69- registerKeyword ("GROUPS" );
70- registerKeyword ("LAG" );
71- registerKeyword ("LAST_VALUE" );
72- registerKeyword ("LEAD" );
73- registerKeyword ("NTH_VALUE" );
74- registerKeyword ("NTILE" );
75- registerKeyword ("PERCENT_RANK" );
76- registerKeyword ("RANK" );
77- registerKeyword ("ROW_NUMBER" );
71+ registerKeyword ( "CUME_DIST" );
72+ registerKeyword ( "DENSE_RANK" );
73+ registerKeyword ( "EXCEPT" );
74+ registerKeyword ( "FIRST_VALUE" );
75+ registerKeyword ( "GROUPS" );
76+ registerKeyword ( "LAG" );
77+ registerKeyword ( "LAST_VALUE" );
78+ registerKeyword ( "LEAD" );
79+ registerKeyword ( "NTH_VALUE" );
80+ registerKeyword ( "NTILE" );
81+ registerKeyword ( "PERCENT_RANK" );
82+ registerKeyword ( "RANK" );
83+ registerKeyword ( "ROW_NUMBER" );
7884 }
7985
8086 @ Override
@@ -134,12 +140,12 @@ public boolean supportsWait() {
134140 }
135141
136142 @ Override
137- boolean supportsForShare () {
143+ protected boolean supportsForShare () {
138144 return false ;
139145 }
140146
141147 @ Override
142- boolean supportsAliasLocks () {
148+ protected boolean supportsAliasLocks () {
143149 return false ;
144150 }
145151
@@ -192,12 +198,13 @@ public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSuppor
192198 return FunctionalDependencyAnalysisSupportImpl .TABLE_REFERENCE ;
193199 }
194200
195- @ Override @ SuppressWarnings ("deprecation" )
201+ @ Override
202+ @ SuppressWarnings ("deprecation" )
196203 public String timestampaddPattern (TemporalUnit unit , TemporalType temporalType , IntervalType intervalType ) {
197204 // TiDB doesn't natively support adding fractional seconds
198205 return unit == TemporalUnit .SECOND && intervalType == null
199206 ? "timestampadd(microsecond,?2*1e6,?3)"
200- : super .timestampaddPattern (unit , temporalType , intervalType );
207+ : super .timestampaddPattern ( unit , temporalType , intervalType );
201208 }
202209
203210 @ Override
0 commit comments