junit « Transaction « Spring Q&A





1. Spring and JUnit annotated tests: creating fixtures in separate transactions    stackoverflow.com

I am testing my Hibernate DAOs with Spring and JUnit. I would like each test method to start with a pre-populated DB, i.e. the Java objects have been saved in the DB, ...

2. JUnit test failing - complaining of missing data that was just inserted    stackoverflow.com

I have an extremely odd problem in my JUnit tests that I just can't seem to nail down. I have a multi-module java webapp project with a fairly standard structure ...

3. Spring @transactional does not start a transaction while testing with JUnit4    stackoverflow.com

I have following configuration.

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx.xsd">

<bean id="dataSource" class="org.springframework.jdbc.datasource.IsolationLevelDataSourceAdapter">
 ...

4. junit test case transaction not getting committed - no errors    stackoverflow.com

We have implemented JUnit4 in our application which uses Spring core & JPA with DB2. We need to test a full functionality which retrieves data from one database and merges into ...

5. How do i write Junit4 tests without Spring transactional test support?    stackoverflow.com

I would like to test transaction rollbacks in my application service. As a result i do not want to use spring's AbstractTransactionalJUnit4SpringContextTests with the @Transactional annotation as that wraps my test ...

6. rollback transaction when testing service with spring + hibernate + junit    stackoverflow.com

i have no problem to test my dao and services, but when i test some "insert" or "update" i want to rollback transaction and no touch my db. Im using @Transactional inside ...

7. Transaction not rolling back in Spring Test for delete operation    stackoverflow.com

Somehow my test is not rolling back the delete transaction when doing a Spring Test. The data is deleted permanently. I am using Spring-Hibernate combo. here is my test class:

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners( {TransactionalTestExecutionListener.class, 
 ...

8. Transactional tests with Spring @ContextConfiguration - clearing database issues    stackoverflow.com

I run my DAO tests within JUnit test class that has proper @ContextConfiguration and @RunWith annotations attached. Individual tests put some data to database and check sanity. They are expected to ...

9. Spring integration test transaction is not rolled back    stackoverflow.com

Writing integration test for spring based application got problem with transaction rollback - data is inserted, but after transaction rolled back, data are still in database table... Spring 3.0.5, JUnit 4.8.2 Integration ...





10. JUnit multiple transaction managers for spring tests    stackoverflow.com

I'm using Spring 3.0.5 and Junit 4.8.2 Is it possible to use multiple transaction managers during tests? Basically I'm try for something like this. I need to add and remove content from two ...

11. Using bidirectional associations from domain objects in @Transactional Junit Tests    stackoverflow.com

I have a @Transactional JUnit Test set up and I want to persist some test data to the database and also test if the associations are correct. However, when testing the associations, ...

12. Spring JMS Testing and Transactional Rollback    stackoverflow.com

I have a test harness using Spring's SpringJUnit4ClassRunner (which automatically rolls back DB updates at the end of each JUnit test). Now I want to test my Spring-based JMS code:

  1. Some ...

14. @Transactional is ignored in Junit4 test    forum.springsource.org

@Transactional is ignored in Junit4 test Hi, I'm trying to convert my test classes to use the @Transactional annotation instead of extending AbstractTransactionalJUnit4SpringContextTests and using @NotTransactional. This is the recommended approach, ...

15. Spring Transactions With Junit    forum.springsource.org

Hello All, I am having problem in running test case with Transaction.. I have created a test case and in test case i have called method that insert some data and ...

16. Hibernate cascading disabled for @Transactional junit tests ?    forum.springsource.org

Hibernate cascading disabled for @Transactional junit tests ? I've got the weird problem that with @Transactional annotated test cases the persisting event cascading does not work. It works when the annotation ...





17. Transactional JUnit @Rules    forum.springsource.org

Some of my transactional JUnit test are broken after upgrading from Spring 3.0.5 to Spring 3.0.6. This appears to be caused by a change in SpringJUnit4ClassRunner [SPR-7705]. Since @Rules are now ...

18. Junit rollback(false) not working    forum.springsource.org

Nov 28th, 2011, 09:14 AM #1 bradox1981 View Profile View Forum Posts Private Message Member Join Date May 2007 Posts 35 Junit rollback(false) not working Hello guys, I making some junit ...

19. Transaction rollback problem on web container. But Junit test is fine.    forum.springsource.org

Transaction rollback problem on web container. But Junit test is fine. I set the not null property as null to test the transaction. I am using spring, hibernate, db2, eclipse, jboss ...

22. @Transactional and JUnit    forum.springsource.org

@Transactional and JUnit I'm adding my first transactional method into a new project and attempting to use @Transactional and tx:annotation-driven. When I run within Tomcat, everything appears to work fine. When ...

23. JUnit can't find TransactionManager?    forum.springsource.org

JUnit can't find TransactionManager? I tried to do: Code: But got: Code: [junit] Caused by: ...

24. Transactional beans and JUnit tests    forum.springsource.org

Hi, i have several TransactionProxyFactoryBeans and i need to prove with JUnit if thay make rollback when espected but i don't know how to do so. I don't know which class ...

25. Yet another JUnit Rollback issue    forum.springsource.org

Yet another JUnit Rollback issue Hi everybody, I'm writing a new application and while writing the JUnit Tests for my first DAOs I found that the transaction rollback is not working ...

26. Transactional Annotation doesn't function during JUNIT test    forum.springsource.org

Transactional Annotation doesn't function during JUNIT test I'm trying to find a way to test Springs transaction management in my JUnit test cases. I've created a Class that extends the AbstractAnnotationAwareTransactionalTests. ...

27. @Transactional annotation is differently interpreted by Junit and classic execution    forum.springsource.org

@Transactional annotation is differently interpreted by Junit and classic execution If i launch the method in a production context, my method is transactionnal and NOT readOnly. BUT, if i launch it ...

28. JUnit testing out of the container with JTA configuration    forum.springsource.org

Hi, I am testing the transactional behaviour of my service layer annotated with Transactional tags. The fact is that Spring seems to load without errors my JTA configuration but the transactional ...

29. Transaction rollback not working in JUnit 4.4    forum.springsource.org

I am using Spring 2.5.6, Junit 4.4 on sjas9_1_u2 I have the following in applicationContext-test.xml Code:

30. JdbcCursorItemReader in Junit4 - Transaction Propagation issue    forum.springsource.org

JdbcCursorItemReader in Junit4 - Transaction Propagation issue Hello, I have a JdbcCursorItemReader which I want to Unit test. The JdbcCursorItemReader is not running in a transaction or running in anew transaction. ...

31. Strange Transaction behaviour in JUnit test    forum.springsource.org

Sep 23rd, 2009, 03:09 AM #1 springexplorer View Profile View Forum Posts Private Message Junior Member Join Date Sep 2009 Posts 26 Strange Transaction behaviour in JUnit test Hello Board, I ...

32. JUnit 4.5 Testing with Spring 3.0 and Hibernate 3 and issue with @Transactional    forum.springsource.org

Apr 1st, 2010, 04:45 PM #1 hgudladona01 View Profile View Forum Posts Private Message Junior Member Join Date Apr 2010 Posts 3 JUnit 4.5 Testing with Spring 3.0 and Hibernate 3 ...

33. junit4 not doing rollback    forum.springsource.org

May 12th, 2010, 02:14 PM #1 flj View Profile View Forum Posts Private Message Member Join Date Apr 2010 Posts 38 [SOLVED] junit4 not doing rollback I have a junit4 test: ...

34. @Transactional in JUnit does not rollback CREATE TABLE    forum.springsource.org

@Transactional in JUnit does not rollback CREATE TABLE Hello, I have a problem with my JUnit tests. I am using the @Transactional annotation to rollback everything that is happening during the ...

35. Transaction in Junit test    forum.springsource.org

Hi I thought that using SpringJUnit4ClassRunner each test method will run in a transactionnal context. It seems to be false. What is the proper why to make sur that each method ...

36. [Spring 3.0][JUnit 4.8] How to stop and start new transactions in JUnit tests    forum.springsource.org

[Spring 3.0][JUnit 4.8] How to stop and start new transactions in JUnit tests Hello, Using JUnit 3.x and org.springframework.test.AbstractTransactionalSpri ngContextTests in Spring 2.5, I was able to start and stop transactions ...