Ken Egervari opened SPR-6133 and commented
Hi, I'd like to submit a feature request. I dunno how hard it would be.
I would like an aop interceptor setup for the spring test framework so that whenever a hibernate session factory is called... or whenever a data access save/update is called that the test framework automatically flushes and clears the session. I realize this might be hibernate-only, but test code can lead to bugs when people don't call .flush() and .clear() after save operations within tests.
It can be worse in that even if .clear() is called, many-to-many relationships will only put save/update to both sides of the relationships... but the join table will not be updated. It will only update if you put a flush() as well from the sessionFactory.
This sounds like a great job for AoP. This would make test code much more streamlined and trivial and less error prone. Can you add it?
Affects: 3.0 M4, 3.0 GA
Comment From: spring-projects-issues
Michael Wiles commented
I'd be keen on this as well from a JPA point of view