Question

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

Was it helpful?

Solution

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top