✅ Parameter Binding
✅ Converter names
Section titled “✅ Converter names”Converter can get names, e.g. @JavaToJdbc("name").
They can only be used by an annotation @JdbcConverterName("name") on a parameter.
Names are unique per scope.
✅ Marker
Section titled “✅ Marker”The Java method parameters are mapped by their names to the corresponding JDBC named parameter markers.
All JDBC named parameter markers must be defined in the Java method and vice versa.
Too many or too few parameters will lead to errors.
JDBC support ’?’ as parameter markers.
Kaumei JDBC does not support ’?’.
It uses named parameter markers, every name is prefixed with ’:’, e.g. :name
- Each
:namemust match a method parameter. Parameters that do not appear in SQL will generated an error.
✅ JDBC basic types
Section titled “✅ JDBC basic types”The following JDBC Java types are mapped by default to the PreparedStatement.set... methods:
java.lang.String,java.math.BigDecimalboolean,byte,short,int,long,float,double,byte[],java.sql.Date,java.sql.Time,java.sql.Timestamp,java.sql.Clob,java.sql.Blob,java.sql.Array,java.sql.Ref,java.net.URL,java.sql.RowId,java.sql.NClob,java.sql.SQLXMLjava.sql.Struct(viasetObject)- In additional the following are supported by a default converter which maps to the
underlying
PreparedStatementmethod:java.lang.Boolean,java.lang.Byte,java.lang.Short,java.lang.Integer,java.lang.Long,java.lang.Float,java.lang.Doublechar,java.lang.Character(viasetString)
- Some JDBC driver do not support all native JDBC types, please check the documentation of your driver.
✅ Java default converter
Section titled “✅ Java default converter”- Records with a single component of a JDBC-supported type automatically gain a converter, if no converter is defined for the record.
- Enums will get automatic a converter with convert it to the name, if no converter is defined for the record.
✅ Custom converter
Section titled “✅ Custom converter”The developer can define converter to set JDBC values from Java
- ✅
A static simple converter which converts a value
Tinto a supported JDBC valueR:static R toDB(T value)- Parameter and return must be
unspecificornon-null. - The method must be annotated with
@JavaToJdbc
- Parameter and return must be
- ✅
A static JDBC converter which sets a value
Ron a givenPreparedStatement:static void toDB(PreparedStatement stmt, int index, T value)The parametervaluemust benullableorunspecific. The method must handelnullcorrectly. The method must be annotated with@JavaToJdbc - ✅
A object method which is annotated with
@JavaToJdbcand returns the object value as JDBC value. The return value must be beunspecificornon-null.
✅ Collections
Section titled “✅ Collections”SQL markers for method parameters that are arrays or single-parameter collections
will be replaced with a list of SQL ? placeholders separated by commas.
This makes it easy to use SQL IN (...) clause.
The number of ? placeholders matches the size of the array or collection.
Please check your JDBC driver and database documentation for any limits on the maximum size of an IN (...) clause.
- Nullable collections/arrays are not allowed
- Nullable markers for the values if the collections are allowed
- Nullable markers for the primitives in arrays are ignored