|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectjp.mosp.common.common.BaseDao
public abstract class BaseDao
Daoの基本機能を提供する。
Statement取得やSQL実行等、DB操作関連メソッドを有する。
フィールドの概要 | |
---|---|
protected String |
aspUserId
ログインASPユーザーID。 |
protected Properties |
cfg
MosPアプリケーション設定(/WEB-INF/mosp.properties)。 |
protected String |
cmd
Command。 |
protected int |
cnt
各種更新SQL実行件数。 |
protected Connection |
conn
DBコネクション。 |
protected int |
index
パラメーターインデックス。 |
protected String |
INSERT_DATE
デフォルト列名(作成者)。 |
protected String |
INSERT_USER
デフォルト列名(作成日)。 |
protected PreparedStatement |
ps
各種SQL実行の際に利用するステートメント。 |
protected ResultSet |
rs
各種検索SQL実行結果。 |
protected String |
UPDATE_DATE
デフォルト列名(更新者)。 |
protected String |
UPDATE_USER
デフォルト列名(更新日)。 |
protected String |
userId
ログインユーザーID。 |
コンストラクタの概要 | |
---|---|
protected |
BaseDao()
コンストラクタ。 |
protected |
BaseDao(Properties cfg,
String cmd,
CmAspUserDto aspUser,
CmUserDto user,
Connection conn)
コンストラクタ。 |
メソッドの概要 | |
---|---|
protected void |
chkDelete(int expectedCount)
削除件数確認。 |
protected void |
chkInsert(int expectedCount)
挿入件数確認。 |
protected void |
chkUpdate(int expectedCount)
更新件数確認。 |
protected void |
clearParams()
パラメータ消去。 |
protected void |
executeQuery()
検索系SQL実行。 |
protected void |
executeUpdate()
更新系SQL実行。 |
protected void |
executeUpdate(boolean needLog)
更新系SQL実行(ログ出力制御付)。 |
protected void |
executeUpdate(Class<?> cls,
int size,
int max,
int idx)
更新系SQLを実行する。 |
protected String |
getAddConditionForKey(Class<?> cls)
キーによる条件SQL取得(追加用)。 |
protected String |
getConditionForKey(Class<?> cls)
キーによる条件SQL取得。 |
protected String |
getDeleteQuery(Class<?> cls)
削除SQL取得。 |
protected String |
getDesc()
DESC SQL取得。 |
protected String |
getForUpdate()
FOR UPDATE SQL取得。 |
protected String |
getInsertQuery(Class<?> cls)
挿入SQL取得。 |
protected String |
getInsertQuery(Class<?> cls,
int size,
int max)
挿入SQLを取得する。 |
protected String |
getLimit()
LIMIT SQL取得。 |
protected String |
getOffset()
OFFSET SQL取得。 |
protected String |
getOrderBy()
ORDER BY SQL取得。 |
protected String |
getOrderForKey(Class<?> cls)
キーによるソートSQL取得。 |
protected String |
getPageStatement(String sortKey,
boolean isAscending)
頁操作用SQL取得。 |
protected int |
getRdbmsType()
RDBMS種類を取得する。 |
protected String |
getSelectCountQuery(Class<?> cls)
件数検索SQLを取得する。 |
protected String |
getSelectCountStatement()
件数検索SQLを取得する。 |
protected String |
getSelectQuery(Class<?> cls)
全件検索SQL取得。 |
protected String |
getSelectStatement(Class<?> cls)
検索SQL取得。 |
protected String |
getSelectStatement(Class<?> cls,
boolean needTableName)
検索SQL文を取得する。 |
protected String |
getTable(Class<?> cls)
テーブル名取得。 |
protected String |
getTableDescriptionQuery(String tableName)
テーブル定義取得SQLを取得する。 |
protected String |
getUpdateQuery(Class<?> cls)
更新SQL取得。 |
void |
initDao(Properties cfg,
String cmd,
CmAspUserDto aspUser,
CmUserDto user,
Connection conn)
DAO初期化。 |
protected void |
mappingCommonInfo(BaseDto dto)
共通情報取得。 |
protected void |
prepareStatement(String sql)
PreparedStatement取得。 |
protected void |
releasePreparedStatement()
PreparedStatement開放。 |
protected void |
releaseResultSet()
ResultSet開放。 |
protected void |
setBinaryParam(int idx,
InputStream param,
int size)
パラメータ設定(InputStream)。 |
protected void |
setCommonParams(boolean isInsert)
共通情報設定。 |
protected void |
setDateParam(int idx,
Date param)
パラメータ設定(Date)。 |
protected void |
setParam(int idx,
Date param)
パラメータ設定(Date)。 |
protected void |
setParam(int idx,
double param)
パラメータ設定(double)。 |
protected void |
setParam(int idx,
float param)
パラメータ設定(float)。 |
protected void |
setParam(int idx,
int param)
パラメータ設定(int)。 |
protected void |
setParam(int idx,
long param)
パラメータ設定(long)。 |
protected void |
setParam(int idx,
String param)
パラメータ設定(String)。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
protected String INSERT_DATE
setCommonParams(boolean)
、
mappingCommonInfo(BaseDto)
で用いられる。
protected String INSERT_USER
setCommonParams(boolean)
、
mappingCommonInfo(BaseDto)
で用いられる。
protected String UPDATE_DATE
setCommonParams(boolean)
、
mappingCommonInfo(BaseDto)
で用いられる。
protected String UPDATE_USER
setCommonParams(boolean)
、
mappingCommonInfo(BaseDto)
で用いられる。
protected Properties cfg
protected String aspUserId
protected String userId
protected String cmd
protected Connection conn
protected PreparedStatement ps
protected ResultSet rs
protected int cnt
protected int index
コンストラクタの詳細 |
---|
protected BaseDao()
protected BaseDao(Properties cfg, String cmd, CmAspUserDto aspUser, CmUserDto user, Connection conn)
initDao(Properties, String, CmAspUserDto, CmUserDto, Connection)
で初期化する。
cfg
- 設定ファイルcmd
- コマンドaspUser
- ASPユーザーuser
- ユーザーconn
- DBコネクションメソッドの詳細 |
---|
public void initDao(Properties cfg, String cmd, CmAspUserDto aspUser, CmUserDto user, Connection conn)
cfg
- 設定ファイルcmd
- コマンドaspUser
- ASPユーザーuser
- ユーザーconn
- DBコネクションprotected void releaseResultSet() throws SQLException
SQLException
protected void prepareStatement(String sql) throws SQLException
sql
- 実行SQL
SQLException
protected void releasePreparedStatement() throws SQLException
SQLException
protected void setParam(int idx, String param) throws SQLException
idx
- インデックスparam
- パラメータ
SQLException
protected void setParam(int idx, int param) throws SQLException
idx
- インデックスparam
- パラメータ
SQLException
protected void setParam(int idx, long param) throws SQLException
idx
- インデックスparam
- パラメータ
SQLException
protected void setParam(int idx, float param) throws SQLException
idx
- インデックスparam
- パラメータ
SQLException
protected void setParam(int idx, double param) throws SQLException
idx
- インデックスparam
- パラメータ
SQLException
protected void setBinaryParam(int idx, InputStream param, int size) throws SQLException
idx
- インデックスparam
- パラメータ
SQLException
protected void setParam(int idx, Date param) throws SQLException
idx
- インデックスparam
- パラメータ
SQLException
protected void setDateParam(int idx, Date param) throws SQLException
idx
- インデックスparam
- パラメータ
SQLException
protected void clearParams() throws SQLException
SQLException
protected void executeQuery() throws SQLException
SQLException
protected void executeUpdate() throws SQLException
SQLException
protected void executeUpdate(boolean needLog) throws SQLException
needLog
- ログ出力要否
SQLException
protected String getSelectQuery(Class<?> cls) throws NoSuchFieldException, IllegalAccessException
cls
- Daoクラス
NoSuchFieldException
IllegalAccessException
protected String getSelectStatement(Class<?> cls) throws IllegalAccessException
cls
- Daoクラス
IllegalAccessException
protected String getSelectStatement(Class<?> cls, boolean needTableName) throws IllegalAccessException, NoSuchFieldException
cls
- Daoクラス
IllegalAccessException
NoSuchFieldException
protected String getSelectCountQuery(Class<?> cls) throws IllegalAccessException, NoSuchFieldException
cls
- Daoクラス
IllegalAccessException
NoSuchFieldException
protected String getSelectCountStatement()
protected String getInsertQuery(Class<?> cls) throws NoSuchFieldException, IllegalAccessException
cls
- dtoクラス
NoSuchFieldException
IllegalAccessException
protected String getUpdateQuery(Class<?> cls) throws NoSuchFieldException, IllegalAccessException
cls
- dtoクラス
NoSuchFieldException
IllegalAccessException
protected String getDeleteQuery(Class<?> cls) throws NoSuchFieldException, IllegalAccessException
cls
- dtoクラス
NoSuchFieldException
IllegalAccessException
protected String getConditionForKey(Class<?> cls) throws IllegalAccessException
cls
- dtoクラス
IllegalAccessException
protected String getAddConditionForKey(Class<?> cls) throws IllegalAccessException
cls
- dtoクラス
IllegalAccessException
protected String getOrderForKey(Class<?> cls) throws IllegalAccessException
cls
- daoクラス
IllegalAccessException
protected String getTable(Class<?> cls) throws NoSuchFieldException, IllegalAccessException
cls
- daoクラス
NoSuchFieldException
IllegalAccessException
MospException
SQLException
protected String getPageStatement(String sortKey, boolean isAscending)
sortKey
- ソートキーisAscending
- 昇順フラグ
protected String getForUpdate()
protected String getOrderBy()
protected String getDesc()
protected String getLimit()
protected String getOffset()
protected void mappingCommonInfo(BaseDto dto) throws SQLException
dto
- 対象dto
SQLException
protected void setCommonParams(boolean isInsert) throws SQLException
isInsert
- 挿入文フラグ(true:挿入文、false:挿入文)
SQLException
protected void chkInsert(int expectedCount) throws MospException
expectedCount
- 想定される挿入件数
MospException
protected void chkUpdate(int expectedCount) throws MospException
expectedCount
- 想定される更新件数
MospException
protected void chkDelete(int expectedCount) throws MospException
expectedCount
- 想定される削除件数
MospException
protected int getRdbmsType() throws MospException
conn
の情報からRDBMSの種類を特定する。
MospException
protected String getTableDescriptionQuery(String tableName) throws MospException
tableName
- テーブル名
SQLException
MospException
protected String getInsertQuery(Class<?> cls, int size, int max) throws IllegalAccessException, NoSuchFieldException
cls
- daoクラスsize
- 挿入レコード数max
- 挿入レコード最大数
IllegalAccessException
NoSuchFieldException
protected void executeUpdate(Class<?> cls, int size, int max, int idx) throws SQLException, IllegalAccessException, NoSuchFieldException
getInsertQuery(Class)
と併せて用いる。
大量のデータを挿入する場合、パフォーマンスの向上が見込める。
cls
- dtoクラスsize
- 挿入対象件数max
- 挿入レコード上限数(一度に挿入する上限)idx
- 処理インデックス
SQLException
IllegalAccessException
NoSuchFieldException
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |