SqlParameterSource implementation that obtains parameter values
from bean properties of a given JavaBean object. The names of the bean
properties have to match the parameter names. Supports components of
record classes as well, with accessor methods matching parameter names.
Uses a Spring BeanWrapper for bean property access underneath.
NamedParameterJdbcTemplate, SimplePropertySqlParameterSource
| Modifier and Type | Field and Description |
|---|---|
| private final BeanWrapper | |
| private String[] |
| Access | Constructor and Description |
|---|---|
| public | BeanPropertySqlParameterSource(Object
the bean instance to wrap object)Create a new BeanPropertySqlParameterSource for the given bean. |
| Modifier and Type | Method and Description |
|---|---|
| public String[] | getParameterNames()
Overrides default org. Enumerate all available parameter names if possible. |
| public String[] | Returns: an array containing all the known property namesProvide access to the property names of the wrapped bean. |
| public int | getSqlType(String
the name of the parameter paramName)Overrides org. Overrides default org. Derives a default SQL type from the corresponding property type. |
| public Object | getValue(String
the name of the parameter paramName)Implements org. Return the parameter value for the requested named parameter. |
| public boolean | hasValue(String
the name of the parameter paramName)Implements org. Determine whether there is a value for the specified named parameter. |
| beanWrapper | back to summary |
|---|---|
| private final BeanWrapper beanWrapper | |
| propertyNames | back to summary |
|---|---|
| private String[] propertyNames
| |
| BeanPropertySqlParameterSource | back to summary |
|---|---|
| public BeanPropertySqlParameterSource(Object object) Create a new BeanPropertySqlParameterSource for the given bean.
| |
| getParameterNames | back to summary |
|---|---|
| public String[] getParameterNames() Overrides default org. Doc from org. Enumerate all available parameter names if possible. This is an optional operation, primarily for use with
| |
| getReadablePropertyNames | back to summary |
|---|---|
| public String[] getReadablePropertyNames() Provide access to the property names of the wrapped bean.
Uses support provided in the
| |
| getSqlType | back to summary |
|---|---|
| public int getSqlType(String paramName) Overrides org. Overrides default org. Derives a default SQL type from the corresponding property type.
| |
| getValue | back to summary |
|---|---|
| public Object getValue(String paramName) throws IllegalArgumentException Implements org. Doc from org. Return the parameter value for the requested named parameter.
| |
| hasValue | back to summary |
|---|---|
| public boolean hasValue(String paramName) Implements org. Doc from org. Determine whether there is a value for the specified named parameter. | |