Class SpringNamedParameterRenderingStrategy
-
Field Summary
Fields inherited from class org.mybatis.dynamic.sql.render.RenderingStrategy
DEFAULT_PARAMETER_PREFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetFormattedJdbcPlaceholder
(String prefix, String parameterName) This method generates a binding for a parameter to a placeholder in a generated SQL statement.getFormattedJdbcPlaceholder
(BindableColumn<?> column, String prefix, String parameterName) This method generates a binding for a parameter to a placeholder in a generated SQL statement.getRecordBasedInsertBinding
(BindableColumn<?> column, String parameterName) This method generates a binding for a parameter to a placeholder in a row based insert statement.getRecordBasedInsertBinding
(BindableColumn<?> column, String prefix, String parameterName) This method generates a binding for a parameter to a placeholder in a row based insert statement.Methods inherited from class org.mybatis.dynamic.sql.render.RenderingStrategy
formatParameterMapKey
-
Constructor Details
-
SpringNamedParameterRenderingStrategy
public SpringNamedParameterRenderingStrategy()
-
-
Method Details
-
getFormattedJdbcPlaceholder
public String getFormattedJdbcPlaceholder(BindableColumn<?> column, String prefix, String parameterName) Description copied from class:RenderingStrategy
This method generates a binding for a parameter to a placeholder in a generated SQL statement.This binding is appropriate when there can be a mapping between a parameter and a known target column, In MyBatis, the binding can specify type information based on the column. The bindings are specific to the target framework.
For MyBatis, a binding looks like this: "#{prefix.parameterName,jdbcType=xxx,typeHandler=xxx,javaType=xxx}"
For Spring, a binding looks like this: ":parameterName"
- Specified by:
getFormattedJdbcPlaceholder
in classRenderingStrategy
- Parameters:
column
- column definition used for generating type details in a MyBatis binding. Ignored for Spring.prefix
- parameter prefix used for locating the parameters in a SQL provider object. Typically, will beRenderingStrategy.DEFAULT_PARAMETER_PREFIX
. This is ignored for Spring.parameterName
- name of the parameter. Typically generated by callingRenderingStrategy.formatParameterMapKey(AtomicInteger)
- Returns:
- the generated binding
-
getFormattedJdbcPlaceholder
Description copied from class:RenderingStrategy
This method generates a binding for a parameter to a placeholder in a generated SQL statement.This binding is appropriate when the parameter is bound to placeholder that is not a known column (such as a limit or offset parameter). The bindings are specific to the target framework.
For MyBatis, a binding looks like this: "#{prefix.parameterName}"
For Spring, a binding looks like this: ":parameterName"
- Specified by:
getFormattedJdbcPlaceholder
in classRenderingStrategy
- Parameters:
prefix
- parameter prefix used for locating the parameters in a SQL provider object. Typically, will beRenderingStrategy.DEFAULT_PARAMETER_PREFIX
. This is ignored for Spring.parameterName
- name of the parameter. Typically generated by callingRenderingStrategy.formatParameterMapKey(AtomicInteger)
- Returns:
- the generated binding
-
getRecordBasedInsertBinding
public String getRecordBasedInsertBinding(BindableColumn<?> column, String prefix, String parameterName) Description copied from class:RenderingStrategy
This method generates a binding for a parameter to a placeholder in a row based insert statement.This binding is specifically for use with insert, batch insert, and multirow insert statements. These statements bind parameters to properties of a row class. The Spring implementation changes the binding to match values expected for a these insert statements. For MyBatis, the binding is the same as
RenderingStrategy.getFormattedJdbcPlaceholder(BindableColumn, String, String)
.For MyBatis, a binding looks like this: "#{prefix.parameterName,jdbcType=xxx,typeHandler=xxx,javaType=xxx}"
For Spring, a binding looks like this: ":prefix.parameterName"
- Overrides:
getRecordBasedInsertBinding
in classRenderingStrategy
- Parameters:
column
- column definition used for generating type details in a MyBatis binding. Ignored for Spring.prefix
- parameter prefix used for locating the parameters in a SQL provider object. Typically, will be either "row" or "records[x]" to match the properties of the generated statement object class.parameterName
- name of the parameter. Typically, this is a property in the row class associated with the insert statement.- Returns:
- the generated binding
-
getRecordBasedInsertBinding
Description copied from class:RenderingStrategy
This method generates a binding for a parameter to a placeholder in a row based insert statement.This binding is specifically for use with insert, batch insert, and multirow insert statements and the MapToRow mapping. These statements bind parameters to the row class directly.
For MyBatis, a binding looks like this: "#{parameterName,jdbcType=xxx,typeHandler=xxx,javaType=xxx}"
For Spring, a binding looks like this: ":parameterName"
- Specified by:
getRecordBasedInsertBinding
in classRenderingStrategy
- Parameters:
column
- column definition used for generating type details in a MyBatis binding. Ignored for Spring.parameterName
- name of the parameter. Typically, will be either "row" or "records[x]" to match the properties of the generated statement object class.- Returns:
- the generated binding
-