|
9 | 9 | import java.util.concurrent.CompletionStage;
|
10 | 10 |
|
11 | 11 | import org.hibernate.boot.registry.StandardServiceInitiator;
|
12 |
| -import org.hibernate.dialect.DatabaseVersion; |
13 | 12 | import org.hibernate.dialect.Dialect;
|
14 |
| -import org.hibernate.dialect.SQLServerDialect; |
15 | 13 | import org.hibernate.engine.jdbc.dialect.spi.DialectFactory;
|
16 | 14 | import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
|
17 | 15 | import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
|
18 | 16 | import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
19 | 17 | import org.hibernate.reactive.engine.jdbc.env.internal.ReactiveJdbcEnvironment;
|
20 |
| -import org.hibernate.reactive.logging.impl.Log; |
21 |
| -import org.hibernate.reactive.logging.impl.LogCategory; |
22 | 18 | import org.hibernate.reactive.pool.ReactiveConnection;
|
23 | 19 | import org.hibernate.reactive.pool.ReactiveConnectionPool;
|
24 | 20 | import org.hibernate.reactive.provider.Settings;
|
|
29 | 25 | import io.vertx.sqlclient.spi.DatabaseMetadata;
|
30 | 26 |
|
31 | 27 | import static java.util.function.Function.identity;
|
32 |
| -import static org.hibernate.reactive.logging.impl.LoggerFactory.make; |
33 | 28 | import static org.hibernate.reactive.util.impl.CompletionStages.completedFuture;
|
34 | 29 |
|
35 | 30 | /**
|
|
39 | 34 | */
|
40 | 35 | public class NoJdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEnvironment> {
|
41 | 36 |
|
42 |
| - /** |
43 |
| - * I'm using the same logger category used in {@link org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl}. |
44 |
| - */ |
45 |
| - private static final Log LOG = make( Log.class, new LogCategory( "SQL dialect" ) ); |
46 |
| - |
47 | 37 | public static final NoJdbcEnvironmentInitiator INSTANCE = new NoJdbcEnvironmentInitiator();
|
48 | 38 |
|
49 | 39 | @Override
|
@@ -75,24 +65,7 @@ public DialectBuilder(Map<String, Object> configurationValues, ServiceRegistry r
|
75 | 65 |
|
76 | 66 | public Dialect build() {
|
77 | 67 | DialectFactory dialectFactory = registry.getService( DialectFactory.class );
|
78 |
| - Dialect dialect = dialectFactory.buildDialect( configurationValues, this::dialectResolutionInfo ); |
79 |
| - return checkDialect( dialect ); |
80 |
| - } |
81 |
| - |
82 |
| - /** |
83 |
| - * Workaround for <a href="https://github.com/eclipse-vertx/vertx-sql-client/issues/1312">vertx-sql-client#1312</a> |
84 |
| - * <p> |
85 |
| - * For extracting the information about sequences, the Sql Server dialect 11+ uses the following query: |
86 |
| - * <pre>{@code select * from INFORMATION_SCHEMA.SEQUENCES}</pre> |
87 |
| - * But, the Vert.x MSSQL client throws an exception when running it. |
88 |
| - */ |
89 |
| - private static Dialect checkDialect(Dialect dialect) { |
90 |
| - if ( dialect instanceof SQLServerDialect && dialect.getVersion().isSameOrAfter( 11 ) ) { |
91 |
| - SQLServerDialect sqlServerDialect = new SQLServerDialect( DatabaseVersion.make( 10 ) ); |
92 |
| - LOG.replacingDialect( dialect, sqlServerDialect ); |
93 |
| - return sqlServerDialect; |
94 |
| - } |
95 |
| - return dialect; |
| 68 | + return dialectFactory.buildDialect( configurationValues, this::dialectResolutionInfo ); |
96 | 69 | }
|
97 | 70 |
|
98 | 71 | private DialectResolutionInfo dialectResolutionInfo() {
|
|
0 commit comments