Skip to content

Instantly share code, notes, and snippets.

@MikaelAmborn
Created February 15, 2011 20:23
Show Gist options
  • Save MikaelAmborn/828170 to your computer and use it in GitHub Desktop.
Save MikaelAmborn/828170 to your computer and use it in GitHub Desktop.
package se.avega.dbunit;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@TestExecutionListeners({DbUnitTransactionPerTestClassListener.class})
@ContextConfiguration(locations={"classpath:testApplicationContext.xml"})
@Transactional(propagation=Propagation.NESTED)
public abstract class DbUnitTestCase extends AbstractTransactionalJUnit4SpringContextTests {
@Autowired
private SessionFactory sessionFactory;
@After
public void clearHibernateSession() {
sessionFactory.getCurrentSession().clear();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment