org.unitedfront2.dao.jdbc
Class DaoSupport
java.lang.Object
org.unitedfront2.dao.jdbc.DaoSupport
- All Implemented Interfaces:
- InitializingBean
- Direct Known Subclasses:
- DateDaoImpl, EmailForwardingDaoImpl, FootmarkDaoImpl, FriendDaoImpl, FriendSubscriptionDaoImpl, SelfIntroductionDaoImpl, SimpleDaoSupport, WidgetDaoImpl
abstract class DaoSupport
- extends Object
- implements InitializingBean
DAO の実装において共通的に利用される機能を提供する抽象クラスです。特別な理由がない限り、DAO の実装
はこのクラスを継承してください。サブクラスは JdbcTemplate 、
NamedParameterJdbcTemplate 、SimpleJdbcTemplate 、
SimpleJdbcInsert を利用できます。これらは、アクセスがあった時点でプロパティに値が設定さ
れます(レイジーロード)。ただし、SimpleJdbcInsert だけは、サブクラスが
createSimpleJdbcInsert(DataSource) を正しく実装していなければ利用できません。
- Author:
- kurokkie
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final Log logger
- ログ
DaoSupport
DaoSupport()
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- Specified by:
afterPropertiesSet in interface InitializingBean
- Throws:
Exception
createSimpleJdbcInsert
protected SimpleJdbcInsert createSimpleJdbcInsert(DataSource dataSource)
- この DAO で利用する
SimpleJdbcInsert を生成します。この実装は null を返してい
ます。SimpleJdbcInsert を利用する場合はサブクラスでこのメソッドをオーバーライドしてく
ださい。
- Parameters:
dataSource - DataSource
- Returns:
SimpleJdbcInsert
setDataSource
public void setDataSource(DataSource dataSource)
getJdbcTemplate
protected JdbcTemplate getJdbcTemplate()
getNamedParameterJdbcTemplate
protected NamedParameterJdbcTemplate getNamedParameterJdbcTemplate()
getSimpleJdbcTemplate
protected SimpleJdbcTemplate getSimpleJdbcTemplate()
getSimpleJdbcInsert
protected SimpleJdbcInsert getSimpleJdbcInsert()
throws UnsupportedOperationException
SimpleJdbcInsert を取得します。サブクラスで
createSimpleJdbcInsert(DataSource) を正しくオーバーライドしていない場合、
このメソッド呼び出しは失敗し、UnsupportedOperationException が発生します。
- Returns:
SimpleJdbcInsert
- Throws:
UnsupportedOperationException - createSimpleJdbcInsert(DataSource) が正しく実装されていない可能性が
あります。
Copyright © 2007-2009 www.unitedfront2.org. All Rights Reserved.