Package org.springframework.jdbc.core.simple

Examples of org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForInt()


            String msg = "Argument 'person' cannot be null.";
            throw new IllegalArgumentException(msg);
        }
       
        final SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(RDBMServices.getDataSource());
        final int struct_count = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM up_layout_struct WHERE user_id = ?", person.getID());
        return struct_count == 0 ? false : true;
       
    }
   
    @SuppressWarnings("unchecked")
View Full Code Here


        Connection connection = dataSource.getConnection();
        new GroovyMigration("1", script).migrate(DatabaseType.H2, connection);
        connection.close();

        SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(dataSource);
        assertThat(jdbcTemplate.queryForInt("select count(*) from users"), is(1));
    }
}
View Full Code Here

        Connection connection = dataSource.getConnection();
        strategy.enableVersioning(DatabaseType.H2, connection);
        connection.close();

        SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(dataSource);
        jdbcTemplate.queryForInt("select count(*)" + VERSION_COLUMN + " from " + TABLE_NAME); // Throws exception is table doesn't exist.
    }

    @Test
    public void testDetermineVersionInUnversionedDatabase() throws SQLException
    {
View Full Code Here

        strategy.enableVersioning(DatabaseType.H2, connection);
        strategy.recordMigration(DatabaseType.H2, connection, v1, new Date(), 768);
        connection.close();

        SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(dataSource);
        assertThat(jdbcTemplate.queryForInt("select count(*) from " + TABLE_NAME), is(1));
        assertThat(jdbcTemplate.queryForObject("select " + VERSION_COLUMN + " from " + TABLE_NAME, String.class), is(v1));

        connection = dataSource.getConnection();
        strategy.recordMigration(DatabaseType.H2, connection, v2, new Date(), 231);
        connection.close();
View Full Code Here

        connection = dataSource.getConnection();
        strategy.recordMigration(DatabaseType.H2, connection, v2, new Date(), 231);
        connection.close();

        assertThat(jdbcTemplate.queryForInt("select count(*) from " + TABLE_NAME), is(2));

        connection = dataSource.getConnection();
        Set<String> appliedMigrations = strategy.appliedMigrations(DatabaseType.H2, connection);
        assertThat(appliedMigrations, hasSize(2));
        assertThat(appliedMigrations, hasItems(v1, v2));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.