-
May 31st, 2006, 09:30 PM
#1
JUnit test extending AbstractTransactionalSpringContextTests
Hello,
I observed some unexpected (to me at least) behavior of my unit test written as a subclass of org.springframework.test.AbstractTransactionalSpri ngContextTests. The test is designed to exercise a Spring DAO fronting a Hibernate entity. It performs standard CRUD plus some relationship operations.
My understanding is that the AbstractTransactionalSpringContextTests makes sure that any changes to the database done during the tests get rolled back. That part works as advertised. The problem is that based on Hibernate log of SQL statements issuet during the test execution, some operations (such as INSERTs or UPDATEs) never take place. The Java statements adding related entities to the database do not generate any SQL statements. To be more exact, when I replace the superclass of my unit test with AbstractDependencyInjectionSpringContextTests (the superclass of AbstractTransactionalSpringContextTests) all databse operation take place as expected. With the transactional class it seems like many of the CRUD operations have no effect on the database. This seem to defeat the purpose of my unit tests.
Is it the expected behavior? If not, what could I be doing wrong?
Thank you.
Michael
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules