|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.jdbc.support.JdbcAccessor
public abstract class JdbcAccessor
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.
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 accessor. |
void |
setDatabaseProductName(String dbName)
Specify the database product name for the DataSource that this accessor uses. |
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 accessor, on first encounter of a SQLException. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Log logger
| Constructor Detail |
|---|
public JdbcAccessor()
| Method Detail |
|---|
public void setDataSource(DataSource dataSource)
public DataSource getDataSource()
public void setDatabaseProductName(String dbName)
dbName - the database product name that identifies the error codes entrySQLErrorCodeSQLExceptionTranslator.setDatabaseProductName(java.lang.String),
DatabaseMetaData.getDatabaseProductName()public void setExceptionTranslator(SQLExceptionTranslator exceptionTranslator)
If no custom translator is provided, a default SQLErrorCodeSQLExceptionTranslator is used which examines the SQLException's vendor-specific error code.
exceptionTranslator - exception translatorSQLErrorCodeSQLExceptionTranslator,
SQLStateSQLExceptionTranslatorpublic SQLExceptionTranslator getExceptionTranslator()
Creates a default SQLErrorCodeSQLExceptionTranslator for the specified DataSource if none set.
public void setLazyInit(boolean lazyInit)
Early initialization only applies if afterPropertiesSet is called.
getExceptionTranslator(),
afterPropertiesSet()public boolean isLazyInit()
public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||