|
16 | 16 | import org.hibernate.reactive.logging.impl.Log;
|
17 | 17 | import org.hibernate.reactive.logging.impl.LoggerFactory;
|
18 | 18 | import org.hibernate.service.spi.ServiceRegistryImplementor;
|
19 |
| -import org.hibernate.sql.ast.spi.JdbcParameterRenderer; |
| 19 | +import org.hibernate.sql.ast.spi.ParameterMarkerStrategy; |
20 | 20 | import org.hibernate.type.descriptor.jdbc.JdbcType;
|
21 | 21 |
|
22 | 22 | /**
|
23 | 23 | * Replaces the JdbcParameterRendererInitiator so to not require
|
24 | 24 | * users to set AvailableSettings.DIALECT_NATIVE_PARAM_MARKERS : this
|
25 | 25 | * gets enforces as the Vert.x SQL clients require it.
|
26 | 26 | */
|
27 |
| -public class NativeParametersRendering implements StandardServiceInitiator<JdbcParameterRenderer> { |
| 27 | +public class NativeParametersHandling implements StandardServiceInitiator<ParameterMarkerStrategy> { |
28 | 28 |
|
29 | 29 | private static final Log LOG = LoggerFactory.make( Log.class, MethodHandles.lookup() );
|
30 | 30 |
|
31 | 31 | /**
|
32 | 32 | * Singleton access
|
33 | 33 | */
|
34 |
| - public static final NativeParametersRendering INSTANCE = new NativeParametersRendering(); |
| 34 | + public static final NativeParametersHandling INSTANCE = new NativeParametersHandling(); |
35 | 35 |
|
36 | 36 | @Override
|
37 |
| - public JdbcParameterRenderer initiateService(Map<String, Object> configurationValues, ServiceRegistryImplementor registry) { |
| 37 | + public ParameterMarkerStrategy initiateService(Map<String, Object> configurationValues, ServiceRegistryImplementor registry) { |
38 | 38 | final Dialect dialect = registry.getService( JdbcServices.class ).getDialect();
|
39 | 39 | final Dialect realDialect = DialectDelegateWrapper.extractRealDialect( dialect );
|
40 |
| - final JdbcParameterRenderer renderer = recommendRendered( realDialect ); |
| 40 | + final ParameterMarkerStrategy renderer = recommendRendered( realDialect ); |
41 | 41 | LOG.debug( "Initializing service JdbcParameterRenderer with implementation: " + renderer.getClass() );
|
42 | 42 | return renderer;
|
43 | 43 | }
|
44 | 44 |
|
45 |
| - private JdbcParameterRenderer recommendRendered(Dialect realDialect) { |
| 45 | + private ParameterMarkerStrategy recommendRendered(Dialect realDialect) { |
46 | 46 | if ( realDialect instanceof PostgreSQLDialect ) {
|
47 | 47 | return new PostgreSQLNativeParameterMarkers();
|
48 | 48 | }
|
49 | 49 | //TBD : Implementations for other DBs
|
50 | 50 | else {
|
51 |
| - return realDialect.getNativeParameterRenderer(); |
| 51 | + return realDialect.getNativeParameterMarkerStrategy(); |
52 | 52 | }
|
53 | 53 | }
|
54 | 54 |
|
55 | 55 | @Override
|
56 |
| - public Class<JdbcParameterRenderer> getServiceInitiated() { |
57 |
| - return JdbcParameterRenderer.class; |
| 56 | + public Class<ParameterMarkerStrategy> getServiceInitiated() { |
| 57 | + return ParameterMarkerStrategy.class; |
58 | 58 | }
|
59 | 59 |
|
60 |
| - private static class PostgreSQLNativeParameterMarkers implements JdbcParameterRenderer { |
| 60 | + private static class PostgreSQLNativeParameterMarkers implements ParameterMarkerStrategy { |
61 | 61 | @Override
|
62 |
| - public String renderJdbcParameter(int position, JdbcType jdbcType) { |
| 62 | + public String createMarker(int position, JdbcType jdbcType) { |
63 | 63 | return "$" + position;
|
64 | 64 | }
|
65 | 65 | }
|
|
0 commit comments