Session/EntityManager and (EntityManagerFactory) is closed following update to Spring Batch 5.1.0

32 Views Asked by At

We have a batch job we use for reporting that was running fine prior to upgrading spring boot / batch in our project. Following general upgrade advice we have migrated our batch tables and upgrades where applicable deprecated cursor classes.

We are now able to run the batch job successfully locally with SELECTs hitting our Hibernate / Database, but this doesn't happen when we deploy in a development environment.

Class which defines the report that is failing is here...

https://github.com/ministryofjustice/hmpps-interventions-service/blob/main/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/reporting/ndmis/performance/NdmisPerformanceReportJobConfiguration.kt

Error we are seeing seems to be caused by IllegalStateException: Session/EntityManager is closed (Then later EntityManagerFactory is closed when saving the batch job status), but we are unable to determine why this is an issue on our development environment but not locally.

Is anyone able to offer any advice please? Is there a bug we should be aware of?

Deploy to a development environment and run the job from a cronjob call. We were expecting successful report output but are seeing errors on database access due to closed EntityManager/EntityManagerFactory

0

There are 0 best solutions below