org.springframework.jdbc.support
Class JdbcAccessor

java.lang.Object
  extended byorg.springframework.jdbc.support.JdbcAccessor
Direct Known Subclasses:
JdbcTemplate, OjbAccessor, SqlMapClientTemplate, SqlMapTemplate

public abstract class JdbcAccessor
extends Object

Base class for JdbcTemplate and other JDBC-accessing DAO helpers, defining common properties like DataSource and exception translator.

Not intended to be used directly. See JdbcTemplate.

Since:
28.11.2003
Author:
Juergen Hoeller
See Also:
JdbcTemplate

Field Summary
protected  Log logger
           
 
Constructor Summary
JdbcAccessor()
           
 
Method Summary
 void afterPropertiesSet()
          Eagerly initialize the exception translator, creating a default one for the specified DataSource if none set.
 DataSource getDataSource()
          Return the DataSource used by this template.
 SQLExceptionTranslator getExceptionTranslator()
          Return the exception translator for this instance.
 boolean isLazyInit()
          Return whether to lazily initialize the SQLExceptionTranslator for this template.
 void setDataSource(DataSource dataSource)
          Set the JDBC DataSource to obtain connections from.
 void setExceptionTranslator(SQLExceptionTranslator exceptionTranslator)
          Set the exception translator for this instance.
 void setLazyInit(boolean lazyInit)
          Set whether to lazily initialize the SQLExceptionTranslator for this template.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final Log logger
Constructor Detail

JdbcAccessor

public JdbcAccessor()
Method Detail

setDataSource

public void setDataSource(DataSource dataSource)
Set the JDBC DataSource to obtain connections from.


getDataSource

public DataSource getDataSource()
Return the DataSource used by this template.


setExceptionTranslator

public void setExceptionTranslator(SQLExceptionTranslator exceptionTranslator)
Set the exception translator for this instance.

If no custom translator is provided, a default is used which examines the SQLException's vendor-specific error code.

Parameters:
exceptionTranslator - exception translator
See Also:
SQLErrorCodeSQLExceptionTranslator, SQLStateSQLExceptionTranslator

getExceptionTranslator

public SQLExceptionTranslator getExceptionTranslator()
Return the exception translator for this instance.

Creates a default one for the specified DataSource if none set.


setLazyInit

public void setLazyInit(boolean lazyInit)
Set whether to lazily initialize the SQLExceptionTranslator for this template. Only applies if afterPropertiesSet is called.

See Also:
getExceptionTranslator(), afterPropertiesSet()

isLazyInit

public boolean isLazyInit()
Return whether to lazily initialize the SQLExceptionTranslator for this template.


afterPropertiesSet

public void afterPropertiesSet()
Eagerly initialize the exception translator, creating a default one for the specified DataSource if none set.



Copyright (C) 2003-2004 The Spring Framework Project.