Announcement Announcement Module
Collapse
No announcement yet.
Transactional tests and simpleJdbcTemplate issues Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transactional tests and simpleJdbcTemplate issues

    Hi there,

    I'm having some issues using simpleJdbcTemplate in my Roo jUnit integration tests. I've marked my test class with @Transactional because I want them all to rollback when I'm done. I'm also trying to use simpleJdbcTemplate because I want to query the database after I've run a test to verify it's state. When I execute the queryForInt method on simpleJdbcTemplate, the test hangs because the sql process is blocked by another. I thought using simpleJdbcTemplate in the transactional method would make it use the same transaction and process.

    As far as I can tell I'm setting up the simpleJdbcTemplate properly using Spring DI:

    Code:
    protected SimpleJdbcTemplate simpleJdbcTemplate;
    		
    @Autowired	
    public void setDataSource(DataSource dataSource) {
    	this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
    }
    If I remove the @Transactional annotation from my test class, the simpleJdbcTemplate query works, but the transaction is not rolled back.

    I'm using SQL Server Express 2008 and Roo 1.0.2.RELEASE [rev 638].

    Does anyone have any ideas?

    Thanks in advance!

    - Caps
Working...
X