Question

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

Était-ce utile?

La 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)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top