jp.terasoluna.fw.web.codelist
Class DBCodeListQuery

java.lang.Object
  extended by org.springframework.jdbc.object.RdbmsOperation
      extended by org.springframework.jdbc.object.SqlOperation
          extended by org.springframework.jdbc.object.SqlQuery
              extended by org.springframework.jdbc.object.MappingSqlQueryWithParameters
                  extended by org.springframework.jdbc.object.MappingSqlQuery
                      extended by jp.terasoluna.fw.web.codelist.DBCodeListQuery
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

public class DBCodeListQuery
extends org.springframework.jdbc.object.MappingSqlQuery

RDBMS operation class that fetches the code list from the database. Code list can be fetched from database by specifying the SQL statement and the data-source to be used to connect with the database as constructor. This class is used only in DBCodeListLoader.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.jdbc.object.MappingSqlQueryWithParameters
org.springframework.jdbc.object.MappingSqlQueryWithParameters.RowMapperImpl
 
Field Summary
 
Fields inherited from class org.springframework.jdbc.object.RdbmsOperation
logger
 
Constructor Summary
DBCodeListQuery(javax.sql.DataSource dataSource, java.lang.String sql)
          Constructor that performs the settings of datasource and SQL statement.
 
Method Summary
private  CodeBean createCodeBean(java.sql.ResultSet rs)
          Fetches the value from ResultSet and generates CodeBean instance.
protected  java.lang.Object mapRow(java.sql.ResultSet rs, int rowNum)
          This method is called at the time of fetching each row.
 
Methods inherited from class org.springframework.jdbc.object.MappingSqlQuery
mapRow
 
Methods inherited from class org.springframework.jdbc.object.MappingSqlQueryWithParameters
newRowMapper
 
Methods inherited from class org.springframework.jdbc.object.SqlQuery
execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, executeByNamedParam, executeByNamedParam, findObject, findObject, findObject, findObject, findObject, findObject, findObject, findObject, findObject, findObject, findObjectByNamedParam, findObjectByNamedParam, getRowsExpected, setRowsExpected
 
Methods inherited from class org.springframework.jdbc.object.SqlOperation
compileInternal, getParsedSql, newPreparedStatementCreator, newPreparedStatementCreator, newPreparedStatementSetter, onCompileInternal
 
Methods inherited from class org.springframework.jdbc.object.RdbmsOperation
afterPropertiesSet, allowsUnusedParameters, checkCompiled, compile, declareParameter, getDeclaredParameters, getGeneratedKeysColumnNames, getJdbcTemplate, getResultSetType, getSql, isCompiled, isReturnGeneratedKeys, isUpdatableResults, setDataSource, setFetchSize, setGeneratedKeysColumnNames, setJdbcTemplate, setMaxRows, setParameters, setQueryTimeout, setResultSetType, setReturnGeneratedKeys, setSql, setTypes, setUpdatableResults, supportsLobParameters, validateNamedParameters, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBCodeListQuery

public DBCodeListQuery(javax.sql.DataSource dataSource,
                       java.lang.String sql)
Constructor that performs the settings of data source and SQL statement.

Parameters:
dataSource - Data source which is used to connect to the database.
sql - SQL statement used for fetching code list.
Method Detail

mapRow

protected java.lang.Object mapRow(java.sql.ResultSet rs,
                                  int rowNum)
                           throws java.sql.SQLException
This method is called at the time of fetching each row.

Consider the first row as "id" and 2nd row as "name" and link the value retreived from database with CodeBean intance.

Specified by:
mapRow in class org.springframework.jdbc.object.MappingSqlQuery
Parameters:
rs - ResultSet that contains the current row information.
rowNum - Row number that is being currently referred. (First is 0th row)
Returns:
Instance in which fetched result is stored.
Throws:
java.sql.SQLException - SQL exception.

createCodeBean

private CodeBean createCodeBean(java.sql.ResultSet rs)
                         throws java.sql.SQLException
Fetches the value from ResultSet and generates CodeBean instance.

Parameters:
rs - ResultSet that retains the value.
Returns:
CodeBean instance in which value is stored.
Throws:
java.sql.SQLException - SQL exception.