Hi all,
I currently make heavy use of HibernateOperations in Spring for working with Hibernate. Some of the time I use a TransactionTemplate to demark a transaction explicitly. However sometimes I just want to save/update a single object. If I just call hibernateOperations.save() with no explicit transaction active then it sort of works (I think auto-commit is coming in to play here) but it means certain events don't fire, like I have a hibernate event listener hooked into the commit transaction which I am missing in this circumstance.
What I am really looking for is a way to easily do something hibernateOperations.saveAndCommit() as I don't really want to have the whole TransactionTemplate + callback noise for simple things like a single save.
I could probably roll my own, just wondering if there's an existing solution/best practice for this.
I am not interested in driving my transactions via annotations at this point, I prefer the explicitness of the code.
Any suggestions welcome.
Cheers.