Juergen,
We had a request on the forums (and I've seen this before) to add
flush() as a method on HibernateTemplate. Of course, this would be
completely useless (or superfluous) in the case there is no existing
thread bound session (or at least an existing outer transaction to bind
the new session to and keep it there afterwards). But most people do use
HibernateTemplate in their DAOs with the expectation that the Session is
already around or will be created and stay around, and it's probably
reasonable to allow them to do a flush without having to use
HibernateCallback, since they could have just done a one-off operation
like save() and then want to ensure that changes go out, for example
when combining with JDBC based operations in a DAO.
What do you think?
|