Browse Source
Not all databases support the JDBCSqlType.NULL. Therefore this handling was made dialect dependent, with SQL Server and DB2 using the old approach, while all others use JDBCSqlType.NULL In the process modified AbstractJdbcConfiguration to use JdbcDialect instead of Dialect. Original pull request #2068 See #1935 See #2031issue/1935-jdbc-sql-type-for-null
12 changed files with 100 additions and 35 deletions
@ -0,0 +1,33 @@ |
|||||||
|
package org.springframework.data.jdbc.core.dialect; |
||||||
|
|
||||||
|
import java.sql.JDBCType; |
||||||
|
import java.sql.SQLType; |
||||||
|
|
||||||
|
/** |
||||||
|
* Interface for defining what to {@link SQLType} to use for {@literal null} values. |
||||||
|
* |
||||||
|
* @author Jens Schauder |
||||||
|
* @since 4.0 |
||||||
|
*/ |
||||||
|
public interface NullTypeStrategy { |
||||||
|
|
||||||
|
/** |
||||||
|
* Implementation that always uses {@link JDBCType#NULL}. Suitable for all databases that actually support this |
||||||
|
* {@link JDBCType}. |
||||||
|
*/ |
||||||
|
NullTypeStrategy DEFAULT = sqlType -> JDBCType.NULL; |
||||||
|
|
||||||
|
/** |
||||||
|
* Implementation that uses what ever type was past in as an argument. Suitable for databases that do not support |
||||||
|
* {@link JDBCType#NULL}. |
||||||
|
*/ |
||||||
|
NullTypeStrategy NOOP = sqlType -> sqlType; |
||||||
|
|
||||||
|
/** |
||||||
|
* {@link SQLType} to use for {@literal null} values. |
||||||
|
* |
||||||
|
* @param sqlType a fallback value that is considered suitable by the caller. |
||||||
|
* @return Guaranteed not to be {@literal null}. |
||||||
|
*/ |
||||||
|
SQLType getNullType(SQLType sqlType); |
||||||
|
} |
||||||
Loading…
Reference in new issue