net.sf.javaprinciples.persistence.db.jdbc.support.support
Class EnhancedBeanPropertySqlParameterSource
java.lang.Object
org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource
net.sf.javaprinciples.persistence.db.jdbc.support.support.EnhancedBeanPropertySqlParameterSource
- All Implemented Interfaces:
- org.springframework.jdbc.core.namedparam.SqlParameterSource
public class EnhancedBeanPropertySqlParameterSource
- extends org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource
A SqlParameterSource for use with Spring JDBC infrastructure that provides functionality combining
the capabilities of BeanPropertySqlParameterSource and MapSqlParameterSource, enhancing them with
additional custom type conversion capabilities and Clob support.
This class allows for an object to be used as a SqlParameterSource for matching properties
(BeanPropertySqlParameterSource functionality) and for additional properties to be specified via
MapSqlParameterSource functionality to cover cases where the object's properties are not sufficient. It also
allows for an object's property values to be overridden since the map properties take precedence.
The implementation allows for an optional ConversionService to be configured that will allow customised
conversion of parameter values prior to them being set. This has been used for example in marshalling an object
into XML using JAXB prior to inserting the value into the database.
- Author:
- rvanluinen
| Fields inherited from interface org.springframework.jdbc.core.namedparam.SqlParameterSource |
TYPE_UNKNOWN |
| Methods inherited from class org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource |
getTypeName, registerSqlType, registerTypeName |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EnhancedBeanPropertySqlParameterSource
public EnhancedBeanPropertySqlParameterSource(org.springframework.core.convert.ConversionService conversionService)
setLobHandler
public void setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)
setBeanParameterSource
public void setBeanParameterSource(Object bean)
addParameter
public void addParameter(String paramName,
Object paramVal)
setSqlTypeForParameter
public void setSqlTypeForParameter(String paramName,
int sqlType)
hasValue
public boolean hasValue(String paramName)
getValue
public Object getValue(String paramName)
throws IllegalArgumentException
- Throws:
IllegalArgumentException
getSqlType
public int getSqlType(String paramName)
- Specified by:
getSqlType in interface org.springframework.jdbc.core.namedparam.SqlParameterSource- Overrides:
getSqlType in class org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource
Copyright © 2013. All Rights Reserved.