Fixed
Details
Assignee
Yoann RodièreYoann RodièreReporter
Yoann RodièreYoann RodièreComponents
Fix versions
Priority
Blocker
Details
Details
Assignee
Yoann Rodière
Yoann RodièreReporter
Yoann Rodière
Yoann RodièreComponents
Fix versions
Priority
Created April 20, 2017 at 6:21 PM
Updated December 3, 2024 at 11:53 AM
Resolved May 2, 2017 at 8:22 AM
See https://github.com/WASdev/standards.jsr352.jbatch/issues/50 for an explanation; in short, our whole approach to store the entity manager factory in the job context is invalid in the reference implementation for JSR-352, so we should rework it.
I think our best course of action would be to:
rely on injection in order to retrieve the EntityManagerFactoryRegistry instead of requiring users to override JobContextSetupListener. We would have, whenever we need to retrieve the entity manager factory, a property like `@Inject private EntityManagerFactoryRegistry emfRegistry`, plus the two batch properties `entityManagerFactoryScope` and `entityManagerFactoryReference`.
move the code currently in JobContextSetupListener to a static utility class, and reuse it wherever we know that the job context may not be set up yet (i.e. when the job starts and when a partition starts).
This implies one major change: remove support for `ActiveSessionFactoryRegistry` (useful in Java SE applications), because if we need injection anyway, there's no reason for such a hack.