File tree 2 files changed +10
-8
lines changed
main/java/org/springframework/r2dbc/connection
test/java/org/springframework/r2dbc/connection 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -72,12 +72,12 @@ public abstract class ConnectionFactoryUtils {
72
72
public static final int CONNECTION_SYNCHRONIZATION_ORDER = 1000 ;
73
73
74
74
private static final Set <Integer > DUPLICATE_KEY_ERROR_CODES = Set .of (
75
- 1 , // Oracle
76
- 301 , // Sap Hana
75
+ 1 , // Oracle
76
+ 301 , // SAP HANA
77
77
1062 , // MySQL/MariaDB
78
78
2601 , // MS SQL Server
79
79
2627 // MS SQL Server
80
- );
80
+ );
81
81
82
82
83
83
/**
@@ -257,11 +257,13 @@ else if (ex instanceof R2dbcNonTransientException) {
257
257
}
258
258
259
259
/**
260
- * Check whether the given SQL state (and the associated error code in case
261
- * of a generic SQL state value) indicate a duplicate key exception. See
262
- * {@code org.springframework.jdbc.support.SQLStateSQLExceptionTranslator#indicatesDuplicateKey}.
260
+ * Check whether the given SQL state and the associated error code (in case
261
+ * of a generic SQL state value) indicate a duplicate key exception:
262
+ * either SQL state 23505 as a specific indication, or the generic SQL state
263
+ * 23000 with a well-known vendor code.
263
264
* @param sqlState the SQL state value
264
- * @param errorCode the error code value
265
+ * @param errorCode the error code
266
+ * @see org.springframework.jdbc.support.SQLStateSQLExceptionTranslator#indicatesDuplicateKey
265
267
*/
266
268
static boolean indicatesDuplicateKey (@ Nullable String sqlState , int errorCode ) {
267
269
return ("23505" .equals (sqlState ) ||
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ void shouldTranslateIntegrityViolationException() {
102
102
103
103
exception = ConnectionFactoryUtils .convertR2dbcException ("" , "" ,
104
104
new R2dbcDataIntegrityViolationException ("reason" , "23000" , 301 ));
105
- assertThat (exception ).isExactlyInstanceOf (DuplicateKeyException .class );
105
+ assertThat (exception ).as ( "SAP HANA" ). isExactlyInstanceOf (DuplicateKeyException .class );
106
106
107
107
exception = ConnectionFactoryUtils .convertR2dbcException ("" , "" ,
108
108
new R2dbcDataIntegrityViolationException ("reason" , "23000" , 1062 ));
You can’t perform that action at this time.
0 commit comments