java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client).
上記のエラーに対する提案を送信してください。Spring Batch フレームワークを使用して csv を読み取り、データベースに保存しています。
java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client).
上記のエラーに対する提案を送信してください。Spring Batch フレームワークを使用して csv を読み取り、データベースに保存しています。
既存のトランザクション内jobLauncher.run(job,jobParameters)から実行すると、このエラーが発生します。(この理由は、Spring Batch がトランザクションを処理して実行とのデータの一貫性をサポートする方法に関するものです...)
これを回避する方法がいくつかあります。
@Transactional(propogation=NOT_SUPPORTED)の呼び出し時にトランザクションが「中断」するようにフラグが立てられますrunrunでください。たとえば、Spring Integration を使用している場合は、Spring Batch IntegrationJobLaunchingMessageHandlerをキューまたは taskexecutor チャネルと組み合わせて使用できます。