net.sf.javaprinciples.persistence.db.jdbc
Class DaoSupport

java.lang.Object
  extended by net.sf.javaprinciples.persistence.db.jdbc.DaoSupport

public abstract class DaoSupport
extends Object

Support class providing common functionality for Product and Task DAOs.

Author:
rvanluinen

Field Summary
protected  org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations jdbcTemplate
           
protected  NamedQueryProvider queryProvider
           
protected  SqlParameterSourceFactory sqlParameterSourceFactory
           
 
Constructor Summary
protected DaoSupport(org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations jdbcTemplate, NamedQueryProvider queryProvider, SqlParameterSourceFactory sqlParameterSourceFactory)
           
 
Method Summary
protected  EnhancedBeanPropertySqlParameterSource getParameterSource()
           
protected  EnhancedBeanPropertySqlParameterSource getParameterSource(Object sourceBean)
           
protected  void logException(String method, org.springframework.dao.DataAccessException ex)
           
protected  long performInsert(org.springframework.jdbc.core.namedparam.SqlParameterSource parameterSource, Enum<?> operation)
          Insert a row.
protected
<T> List<T>
performQuery(org.springframework.jdbc.core.namedparam.SqlParameterSource parameterSource, Enum<?> operation, org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> rowMapper)
           
protected  int performQueryForIntResult(org.springframework.jdbc.core.namedparam.SqlParameterSource parameterSource, Enum<?> operation)
           
protected
<T> T
performQueryForSingleResult(org.springframework.jdbc.core.namedparam.SqlParameterSource parameterSource, Enum<?> operation, org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> rowMapper)
           
protected
<T> T
performQueryForZeroToSingleResult(org.springframework.jdbc.core.namedparam.SqlParameterSource parameterSource, Enum<?> operation, org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> rowMapper)
           
 void setPrimaryKeyColumnName(String primaryKeyColumnName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jdbcTemplate

protected org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations jdbcTemplate

queryProvider

protected NamedQueryProvider queryProvider

sqlParameterSourceFactory

protected SqlParameterSourceFactory sqlParameterSourceFactory
Constructor Detail

DaoSupport

protected DaoSupport(org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations jdbcTemplate,
                     NamedQueryProvider queryProvider,
                     SqlParameterSourceFactory sqlParameterSourceFactory)
Method Detail

logException

protected void logException(String method,
                            org.springframework.dao.DataAccessException ex)

performInsert

protected long performInsert(org.springframework.jdbc.core.namedparam.SqlParameterSource parameterSource,
                             Enum<?> operation)
Insert a row.

Parameters:
parameterSource - The columns to persist, must not be null
operation - The query to obtain to facilitate the insert. Must not be null.
Returns:
The primary key returned from the persistent store.

performQuery

protected <T> List<T> performQuery(org.springframework.jdbc.core.namedparam.SqlParameterSource parameterSource,
                                   Enum<?> operation,
                                   org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> rowMapper)

performQueryForZeroToSingleResult

protected <T> T performQueryForZeroToSingleResult(org.springframework.jdbc.core.namedparam.SqlParameterSource parameterSource,
                                                  Enum<?> operation,
                                                  org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> rowMapper)

performQueryForSingleResult

protected <T> T performQueryForSingleResult(org.springframework.jdbc.core.namedparam.SqlParameterSource parameterSource,
                                            Enum<?> operation,
                                            org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> rowMapper)

performQueryForIntResult

protected int performQueryForIntResult(org.springframework.jdbc.core.namedparam.SqlParameterSource parameterSource,
                                       Enum<?> operation)

getParameterSource

protected EnhancedBeanPropertySqlParameterSource getParameterSource()

getParameterSource

protected EnhancedBeanPropertySqlParameterSource getParameterSource(Object sourceBean)

setPrimaryKeyColumnName

public void setPrimaryKeyColumnName(String primaryKeyColumnName)


Copyright © 2013. All Rights Reserved.