Oct 31st, 2008, 03:07 AM
Stateful vs Stateless Hibernate session
I'm using Hibernate for data access in my batch job. I understand using hibernate stateful session is not feasible in batch application and hence HibernateCursorItemReader is used for reading input data using stateless session. But does that mean we need to use stateless session even for saving(insert, update) the output data to database. If, yes how should we take care of the transaction management in our DAO using stateless session. I guess spring doesn't provide support for stateless session through HibernateDaoSupport.
Please clarify me on this.
Nov 3rd, 2008, 11:41 AM
You can use a stateful session in a dao as your writer, but you have to be careful about how you flush, which is described in the reference documentation: http://static.springframework.org/sp...e.html#d0e2581
Nov 4th, 2008, 05:53 AM
Lucas, Thanks for replying..
Does that mean we cannot use stateless session for operations like save/update in spring batch?