java - Does spring junit rollback by default? -


i'm testing dao layer using spring , junit. test:

@contextconfiguration(locations = "classpath:application-context-test.xml") @runwith(springjunit4classrunner.class) public class testemployeedao {  @autowired private employeedao employeedao;  @test @transactional public void testinsertemployee(){     employee employee = new employee("abdel karim");     employeedao.insert(employee);     .     .     .      } } } 

but when execute test , check database find no row inserted, , no exception thrown. don't understand why, default behaviour of spring (springjunit4classrunner) rollback transaction?

thanks in advance.

yes, default rollback true. switch off use:

@test @transactional @rollback(false) public void testinsertemployee(){     employee employee = new employee("abdel karim");     employeedao.insert(employee); } 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -