I'm writing a test to see if my getHibernateTemplate().delete(x) works. Now I've discovered that in a single test there seems to be some caching (my test class extends extends AbstractTransactionalDataSourceSpringContextTests).
What I mean is the following. My delete function:
does it exist? yes: delete it and return true no: return false.
Now I try to do two asserts in my test function. the first is an assertTrue to check if it's actually deleted the second is an assertFalse to see that it correctly returns false.
However my second test fails, and when I debug it it does indeed go to the true section.
However if I add the following line getHibernateTemplate().find("from classX"); as the first line in the delete function it works as intended. Even though I do nothing with the value. So a caching problem seems to be the most logical.
Does anyone have any advice, because leaving the line in there seems a bit dirty.