7
7
8
8
import org .hibernate .dialect .Dialect ;
9
9
import org .hibernate .dialect .DialectDelegateWrapper ;
10
- import org .hibernate .dialect .PostgreSQLDialect ;
11
10
import org .hibernate .dialect .identity .IdentityColumnSupport ;
12
- import org .hibernate .engine .spi .SessionFactoryImplementor ;
13
11
import org .hibernate .metamodel .mapping .EntityMappingType ;
14
12
import org .hibernate .metamodel .spi .RuntimeModelCreationContext ;
15
13
import org .hibernate .query .sqm .mutation .spi .SqmMultiTableInsertStrategy ;
16
14
import org .hibernate .query .sqm .mutation .spi .SqmMultiTableMutationStrategy ;
17
15
import org .hibernate .reactive .dialect .identity .ReactiveIdentityColumnSupportAdapter ;
18
16
import org .hibernate .reactive .query .sqm .mutation .internal .cte .ReactiveCteInsertStrategy ;
19
17
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 ;
26
18
27
19
/**
28
20
* Wraps the given dialect to make some internal components reactive;
31
23
*/
32
24
public final class ReactiveDialectWrapper extends DialectDelegateWrapper {
33
25
34
- //FIXME remove PostgreSQLDialect specific workarounds after HHH-16229
35
- private final boolean requiresPostgreSQLSyntaxProcessing ;
36
-
37
26
public ReactiveDialectWrapper (Dialect wrapped ) {
38
27
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
- }
55
28
}
56
29
57
30
@ Override
@@ -60,12 +33,16 @@ public IdentityColumnSupport getIdentityColumnSupport() {
60
33
}
61
34
62
35
@ Override
63
- public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy (EntityMappingType rootEntityDescriptor , RuntimeModelCreationContext runtimeModelCreationContext ) {
36
+ public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy (
37
+ EntityMappingType rootEntityDescriptor ,
38
+ RuntimeModelCreationContext runtimeModelCreationContext ) {
64
39
return new ReactiveCteMutationStrategy ( rootEntityDescriptor , runtimeModelCreationContext );
65
40
}
66
41
67
42
@ Override
68
- public SqmMultiTableInsertStrategy getFallbackSqmInsertStrategy (EntityMappingType rootEntityDescriptor , RuntimeModelCreationContext runtimeModelCreationContext ) {
43
+ public SqmMultiTableInsertStrategy getFallbackSqmInsertStrategy (
44
+ EntityMappingType rootEntityDescriptor ,
45
+ RuntimeModelCreationContext runtimeModelCreationContext ) {
69
46
return new ReactiveCteInsertStrategy ( rootEntityDescriptor , runtimeModelCreationContext );
70
47
}
71
48
0 commit comments