|
From: <jue...@we...> - 2004-09-01 20:42:22
|
Well, that's what HibernateTemplate's FLUSH_EAGER mode is meant for: To = automatically flush right after each operation, even if a prebound = Session is used. I would generally recommend to use such a preconfigured = HibernateTemplate instance here, no matter if a shared one like in a = HibernateDaoSupport or a newly instantiated one for a given = SessionFactory. =20 I'm not keen on a flush operation on HibernateTemplate itself: That's = not really a data access operation like the other methods there, but = rather a method that just modifies the state of the transaction. If = someone doesn't like the approach with a preconfigured = HibernateTemplate, there's still the option of a custom = HibernateCallback, even if just for a save and a flush. =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von Colin Sampaleanu Gesendet: Mi 01.09.2004 17:34 An: spr...@li... Betreff: [Springframework-developer] flush() method on HibernateTemplate 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? ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |