I'm just getting to know spring-batch and I hope someone can answer my question about why I need to set hibernate.connection.release_mode to value 'on_close'.
When I run with no special configuration the scrollablecursor gets closed after each transaction (read chunck/commit-interval) and throws an JDBCException with connection closed when trying to get the next row of the cursor. However if i set hibernate.connection.release_mode to value 'on_close' it does not close my session and keeps this way my connection open.
isolation="DEFAULT" propagation="REQUIRED" />
<batch:chunk reader="MessageHandlerItemReader" writer="MessageHandlerItemWriter"
<bean id="MessageHandlerItemReader" class="MessageHandlerXItemReader" />
<bean id="MessageHandlerItemWriter" class="MessageHandlerXItemWriter" />
My problem lies in the fact that the Hibernate documentation states that 'on_close' should not be used anymore, and it is there for backwards compatibility only. That means I have made a mistake allong the line for needing it in the first place. It also states that with after_statement the session won't be closed when there is a scrollablecursor active. This however does not compute with the behavior I see and also does not compute with the implementation in the software. Atleast not where my debugging session leads to.
Anyone have had this same problem? Are there other ways to avoid using on_close?