public class

BeanPropertySqlParameterSource

extends AbstractSqlParameterSource
java.lang.Object
   ↳ org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource
     ↳ org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource

Class Overview

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.

Uses a Spring BeanWrapper for bean property access underneath.

Summary

[Expand]
Inherited Constants
From interface org.springframework.jdbc.core.namedparam.SqlParameterSource
Public Constructors
BeanPropertySqlParameterSource(Object object)
Create a new BeanPropertySqlParameterSource for the given bean.
Public Methods
String[] getReadablePropertyNames()
Provide access to the property names of the wrapped bean.
int getSqlType(String paramName)
Derives a default SQL type from the corresponding property type.
Object getValue(String paramName)
boolean hasValue(String paramName)
[Expand]
Inherited Methods
From class org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource
From class java.lang.Object
From interface org.springframework.jdbc.core.namedparam.SqlParameterSource

Public Constructors

public BeanPropertySqlParameterSource (Object object)

Create a new BeanPropertySqlParameterSource for the given bean.

Parameters
object the bean instance to wrap

Public Methods

public String[] getReadablePropertyNames ()

Provide access to the property names of the wrapped bean. Uses support provided in the PropertyAccessor interface.

Returns
  • an array containing all the known property names

public int getSqlType (String paramName)

Derives a default SQL type from the corresponding property type.

Parameters
paramName the name of the parameter
Returns
  • the SQL type of the parameter, or TYPE_UNKNOWN if not registered

public Object getValue (String paramName)

public boolean hasValue (String paramName)