• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Integration test on JDBC (No Hibernate !) and Spring AbstractTransactionalJUnit4SpringContextTests

 
Stephane Eybert
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to set up an integration test against a MySql database with a pure JDBC dao, that is, NOT using Hibernate or any ORM tool.

My base abstract test class uses the AbstractTransactionalJUnit4SpringContextTests class so as to have tests that roll back.



Spring requires a transactionManager bean which I provide.



But I get an exception.



Do I need to provide some connection pooling ?

Is there any way to do it with a Spring bean ?

Kind Regards,

Stephane

 
Rob Spoor
Sheriff
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're calling setAutoCommit on a Connection that's already closed.
 
Stephane Eybert
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How come is the connection closed ?


 
Rob Spoor
Sheriff
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because line 32 comes before line 38.
 
Stephane Eybert
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fair enough :-) Thanks !
 
Rob Spoor
Sheriff
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic