Skip to content

Commit 18c89ea

Browse files
SanneDavideD
authored andcommitted
No longer need to override the SqlAstTranslatorFactory
1 parent b2c5edc commit 18c89ea

File tree

2 files changed

+6
-55
lines changed

2 files changed

+6
-55
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/dialect/ReactiveDialectWrapper.java

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,14 @@
77

88
import org.hibernate.dialect.Dialect;
99
import org.hibernate.dialect.DialectDelegateWrapper;
10-
import org.hibernate.dialect.PostgreSQLDialect;
1110
import org.hibernate.dialect.identity.IdentityColumnSupport;
12-
import org.hibernate.engine.spi.SessionFactoryImplementor;
1311
import org.hibernate.metamodel.mapping.EntityMappingType;
1412
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
1513
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
1614
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
1715
import org.hibernate.reactive.dialect.identity.ReactiveIdentityColumnSupportAdapter;
1816
import org.hibernate.reactive.query.sqm.mutation.internal.cte.ReactiveCteInsertStrategy;
1917
import org.hibernate.reactive.query.sqm.mutation.internal.cte.ReactiveCteMutationStrategy;
20-
import org.hibernate.reactive.sql.ast.spi.ReactivePostgreSQLSqlAstTranslator;
21-
import org.hibernate.sql.ast.SqlAstTranslator;
22-
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
23-
import org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory;
24-
import org.hibernate.sql.ast.tree.Statement;
25-
import org.hibernate.sql.exec.spi.JdbcOperation;
2618

2719
/**
2820
* Wraps the given dialect to make some internal components reactive;
@@ -31,27 +23,8 @@
3123
*/
3224
public final class ReactiveDialectWrapper extends DialectDelegateWrapper {
3325

34-
//FIXME remove PostgreSQLDialect specific workarounds after HHH-16229
35-
private final boolean requiresPostgreSQLSyntaxProcessing;
36-
3726
public ReactiveDialectWrapper(Dialect wrapped) {
3827
super( wrapped );
39-
this.requiresPostgreSQLSyntaxProcessing = ( wrapped instanceof PostgreSQLDialect );
40-
}
41-
42-
@Override
43-
public SqlAstTranslatorFactory getSqlAstTranslatorFactory() {
44-
if ( requiresPostgreSQLSyntaxProcessing ) {
45-
return new StandardSqlAstTranslatorFactory() {
46-
@Override
47-
protected <T extends JdbcOperation> SqlAstTranslator<T> buildTranslator(SessionFactoryImplementor sessionFactory, Statement statement) {
48-
return new ReactivePostgreSQLSqlAstTranslator<>( sessionFactory, statement );
49-
}
50-
};
51-
}
52-
else {
53-
return wrapped.getSqlAstTranslatorFactory();
54-
}
5528
}
5629

5730
@Override
@@ -60,12 +33,16 @@ public IdentityColumnSupport getIdentityColumnSupport() {
6033
}
6134

6235
@Override
63-
public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy(EntityMappingType rootEntityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext) {
36+
public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy(
37+
EntityMappingType rootEntityDescriptor,
38+
RuntimeModelCreationContext runtimeModelCreationContext) {
6439
return new ReactiveCteMutationStrategy( rootEntityDescriptor, runtimeModelCreationContext );
6540
}
6641

6742
@Override
68-
public SqmMultiTableInsertStrategy getFallbackSqmInsertStrategy(EntityMappingType rootEntityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext) {
43+
public SqmMultiTableInsertStrategy getFallbackSqmInsertStrategy(
44+
EntityMappingType rootEntityDescriptor,
45+
RuntimeModelCreationContext runtimeModelCreationContext) {
6946
return new ReactiveCteInsertStrategy( rootEntityDescriptor, runtimeModelCreationContext );
7047
}
7148

hibernate-reactive-core/src/main/java/org/hibernate/reactive/sql/ast/spi/ReactivePostgreSQLSqlAstTranslator.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)