クラス JpaCursorItemReader<T>
java.lang.ObjectSE
org.springframework.batch.item.ItemStreamSupport
org.springframework.batch.item.support.AbstractItemStreamItemReader<T>
org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
org.springframework.batch.item.database.JpaCursorItemReader<T>
- 型パラメーター:
T- 読むアイテムの種類
- 実装されているすべてのインターフェース:
ItemReader<T>、ItemStream、ItemStreamReader<T>、org.springframework.beans.factory.InitializingBean
public class JpaCursorItemReader<T>
extends AbstractItemCountingItemStreamItemReader<T>
implements org.springframework.beans.factory.InitializingBean
JPA
Query.getResultStream() に基づく ItemStreamReader 実装。初期化時に JPQL クエリを実行し、AbstractItemCountingItemStreamItemReader.read() メソッドが呼び出されるときに結果セットを反復処理して、現在の行に対応するオブジェクトを返します。クエリは、setQueryString(String) を使用して直接設定することも、setQueryProvider(JpaQueryProvider) 経由でクエリプロバイダーを使用して設定することもできます。実装はスレッドセーフではありません。
- 導入:
- 4.3
- 作成者:
- Mahmoud Ben Hassine
コンストラクターの概要
コンストラクターメソッドのサマリー
修飾子と型メソッド説明voidprotected voiddoClose()AbstractItemCountingItemStreamItemReader.doOpen()で開いたリソースを閉じます。protected voiddoOpen()入力の読み取りを開始するために必要なリソースを開きます。protected TdoRead()入力から次の項目を読み取ります。voidsetEntityManagerFactory(jakarta.persistence.EntityManagerFactory entityManagerFactory) JPA エンティティマネージャーファクトリを設定します。voidsetParameterValues(MapSE<StringSE, ObjectSE> parameterValues) クエリの実行に使用するパラメーター値を設定します。voidsetQueryProvider(JpaQueryProvider queryProvider) JPA クエリプロバイダーを設定します。voidsetQueryString(StringSE queryString) JPQL クエリ文字列を設定します。voidupdate(ExecutionContext executionContext) 空のExecutionContextを返します。クラス org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader から継承されたメソッド
close, getCurrentItemCount, isSaveState, jumpToItem, open, read, setCurrentItemCount, setMaxItemCount, setSaveStateクラス org.springframework.batch.item.ItemStreamSupport から継承されたメソッド
getExecutionContextKey, getName, setExecutionContextName, setName
コンストラクターの詳細
JpaCursorItemReader
public JpaCursorItemReader()新しいJpaCursorItemReaderを作成します。
メソッドの詳細
setEntityManagerFactory
public void setEntityManagerFactory(jakarta.persistence.EntityManagerFactory entityManagerFactory) JPA エンティティマネージャーファクトリを設定します。- パラメーター:
entityManagerFactory- JPA エンティティマネージャーファクトリ
setQueryProvider
JPA クエリプロバイダーを設定します。- パラメーター:
queryProvider- JPA クエリプロバイダー
setQueryString
JPQL クエリ文字列を設定します。- パラメーター:
queryString- JPQL クエリ文字列
setParameterValues
クエリの実行に使用するパラメーター値を設定します。- パラメーター:
parameterValues- クエリ文字列で使用されるパラメーター名によってキー設定された値。
afterPropertiesSet
- 次で指定:
- インターフェース
org.springframework.beans.factory.InitializingBeanのafterPropertiesSet - 例外:
ExceptionSE
doOpen
クラスからコピーされた説明:AbstractItemCountingItemStreamItemReader入力の読み取りを開始するために必要なリソースを開きます。- 次で指定:
- クラス
AbstractItemCountingItemStreamItemReader<T>のdoOpen - 例外:
ExceptionSE- サブクラスがフレームワークによる解釈のためにチェック済み例外をスローできるようにします
doRead
クラスからコピーされた説明:AbstractItemCountingItemStreamItemReader入力から次の項目を読み取ります。- 次で指定:
- クラス
AbstractItemCountingItemStreamItemReader<T>のdoRead - 戻り値:
- データソースが使い果たされた場合、アイテムまたは
null
update
クラスからコピーされた説明:ItemStreamSupport空のExecutionContextを返します。- 次で指定:
- インターフェース
ItemStreamのupdate - オーバーライド:
- クラス
AbstractItemCountingItemStreamItemReader<T>のupdate - パラメーター:
executionContext- 更新される- 例外:
ItemStreamException- 関連事項:
doClose
protected void doClose()クラスからコピーされた説明:AbstractItemCountingItemStreamItemReaderAbstractItemCountingItemStreamItemReader.doOpen()で開いたリソースを閉じます。- 次で指定:
- クラス
AbstractItemCountingItemStreamItemReader<T>のdoClose