org.seasar.extension.jdbc.service
クラス S2AbstractService<T>

java.lang.Object
  上位を拡張 org.seasar.extension.jdbc.service.S2AbstractService<T>
型パラメータ:
T - エンティティの型

public abstract class S2AbstractService<T>
extends Object

サービスを作るベースクラスです。

作成者:
higa

フィールドの概要
protected  Class<T> entityClass
          エンティティのクラスです。
protected  JdbcManager jdbcManager
          JDBCマネージャです。
protected  String sqlFilePathPrefix
          SQLファイルのパスのプレフィックスです。
 
コンストラクタの概要
S2AbstractService()
          コンストラクタです。
S2AbstractService(Class<T> entityClass)
          コンストラクタです。
 
メソッドの概要
 int delete(T entity)
          エンティティを削除します。
 List<T> findAll()
          すべてのエンティティを検索します。
 List<T> findByCondition(BeanMap conditions)
          条件付で検索します。
 long getCount()
          件数を返します。
 int insert(T entity)
          エンティティを挿入します。
 AutoSelect<T> select()
          自動検索を返します。
<T2> SqlFileSelect<T2>
selectBySqlFile(Class<T2> baseClass, String path)
          SQLファイル検索を返します。
<T2> SqlFileSelect<T2>
selectBySqlFile(Class<T2> baseClass, String path, Object parameter)
          SQLファイル検索を返します。
protected  void setEntityClass(Class<T> entityClass)
          エンティティのクラスを設定します。
 int update(T entity)
          エンティティを更新します。
 SqlFileUpdate updateBySqlFile(String path)
          SQLファイル更新を返します。
 SqlFileUpdate updateBySqlFile(String path, Object parameter)
          SQLファイル更新を返します。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

jdbcManager

protected JdbcManager jdbcManager
JDBCマネージャです。


entityClass

protected Class<T> entityClass
エンティティのクラスです。


sqlFilePathPrefix

protected String sqlFilePathPrefix
SQLファイルのパスのプレフィックスです。

コンストラクタの詳細

S2AbstractService

public S2AbstractService()
コンストラクタです。


S2AbstractService

public S2AbstractService(Class<T> entityClass)
コンストラクタです。

パラメータ:
entityClass - エンティティのクラス
メソッドの詳細

select

public AutoSelect<T> select()
自動検索を返します。

戻り値:
自動検索

findAll

public List<T> findAll()
すべてのエンティティを検索します。

戻り値:
すべてのエンティティ

findByCondition

public List<T> findByCondition(BeanMap conditions)
条件付で検索します。

パラメータ:
conditions - 条件
戻り値:
エンティティのリスト
関連項目:
AutoSelect.where(Map)

getCount

public long getCount()
件数を返します。

戻り値:
件数

insert

public int insert(T entity)
エンティティを挿入します。

パラメータ:
entity - エンティティ
戻り値:
更新した行数

update

public int update(T entity)
エンティティを更新します。

パラメータ:
entity - エンティティ
戻り値:
更新した行数

delete

public int delete(T entity)
エンティティを削除します。

パラメータ:
entity - エンティティ
戻り値:
更新した行数

selectBySqlFile

public <T2> SqlFileSelect<T2> selectBySqlFile(Class<T2> baseClass,
                                              String path)
SQLファイル検索を返します。

型パラメータ:
T2 - 戻り値のJavaBeansの型
パラメータ:
baseClass - 戻り値のJavaBeansのクラス
path - エンティティのディレクトリ部分を含まないSQLファイルのパス
戻り値:
SQLファイル検索

selectBySqlFile

public <T2> SqlFileSelect<T2> selectBySqlFile(Class<T2> baseClass,
                                              String path,
                                              Object parameter)
SQLファイル検索を返します。

型パラメータ:
T2 - 戻り値のJavaBeansの型
パラメータ:
baseClass - 戻り値のJavaBeansのクラス
path - エンティティのディレクトリ部分を含まないSQLファイルのパス
parameter -

パラメータ。

パラメータが1つしかない場合は、値を直接指定します。 パラメータが複数ある場合は、JavaBeansを作って、 プロパティ名をSQLファイルのバインド変数名とあわせます。 JavaBeansはpublicフィールドで定義することもできます。

パラメータが1つで型がDateCalendarのいずれか場合、Parameterに定義されたメソッドによりパラメータの時制を指定できます。

パラメータが1つで型がStringbyte[]Serializableのいずれかの場合、Parameterに定義されたメソッドによりパラメータをラージオブジェクトとして扱えます。

戻り値:
SQLファイル検索

updateBySqlFile

public SqlFileUpdate updateBySqlFile(String path)
SQLファイル更新を返します。

パラメータ:
path - エンティティのディレクトリ部分を含まないSQLファイルのパス
戻り値:
SQLファイル更新

updateBySqlFile

public SqlFileUpdate updateBySqlFile(String path,
                                     Object parameter)
SQLファイル更新を返します。

パラメータ:
path - エンティティのディレクトリ部分を含まないSQLファイルのパス
parameter - パラメータ用のJavaBeans
戻り値:
SQLファイル更新

setEntityClass

protected void setEntityClass(Class<T> entityClass)
エンティティのクラスを設定します。

パラメータ:
entityClass - エンティティのクラス


Copyright ? 2004-2008 The Seasar Foundation. All Rights Reserved.