0

How to use hibernate detached criteria with "HibernateCursorItemReader" of spring batch?

Soutrick
  • 77
  • 1
  • 9

1 Answers1

0

A solution could be the following:

  1. create a custom HibernateDetachedCriteriaItemReader<> extends AbstractItemCountingItemStreamItemReader<>
  2. add a property Criteria criteria and inject it before use
  3. rewrite all do*() functions to manage resultset lifecycle

Or extends from HibernateCursorItemReader and override doOpen() to let working in dual-mode (normal,with detached criteria)

Luca Basso Ricci
  • 17,829
  • 2
  • 47
  • 69