Skip to content

Commit 3538d7b

Browse files
committed
[#1564] Add sql parameters strategy for MS SQL Server
1 parent a6695b7 commit 3538d7b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/provider/service/NativeParametersHandling.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.hibernate.dialect.Dialect;
1313
import org.hibernate.dialect.DialectDelegateWrapper;
1414
import org.hibernate.dialect.PostgreSQLDialect;
15+
import org.hibernate.dialect.SQLServerDialect;
1516
import org.hibernate.engine.jdbc.spi.JdbcServices;
1617
import org.hibernate.reactive.logging.impl.Log;
1718
import org.hibernate.reactive.logging.impl.LoggerFactory;
@@ -54,8 +55,9 @@ private ParameterMarkerStrategy recommendRendered(Dialect realDialect) {
5455
if ( realDialect instanceof PostgreSQLDialect ) {
5556
return new PostgreSQLNativeParameterMarkers();
5657
}
57-
//TBD : Implementations for other DBs
58-
58+
if ( realDialect instanceof SQLServerDialect ) {
59+
return new SqlServerNativeParameterMarkers();
60+
}
5961
return realDialect.getNativeParameterMarkerStrategy() == null
6062
? ParameterMarkerStrategyStandard.INSTANCE
6163
: realDialect.getNativeParameterMarkerStrategy();
@@ -73,4 +75,11 @@ public String createMarker(int position, JdbcType jdbcType) {
7375
}
7476
}
7577

78+
private static class SqlServerNativeParameterMarkers implements ParameterMarkerStrategy {
79+
@Override
80+
public String createMarker(int position, JdbcType jdbcType) {
81+
return "@P" + position;
82+
}
83+
}
84+
7685
}

0 commit comments

Comments
 (0)