[Spring Testing] Call hibernateTemplate.flush() manually

http://static.springsource.org/spring/docs/2.5.6/reference/testing.html

8.3.7.5.2. JUnit 4.4 support classes

simpleJdbcTemplate: useful for querying to confirm state. For example,
you might query before and after testing application code that creates an object and persists it using an ORM tool, to verify that the data appears in the database. (Spring will ensure that the query runs in the scope of the same transaction.)
You will need to tell your ORM tool to ‘flush’ its changes for this to work correctly, for example using the flush() method on Hibernate’s Session interface.

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.