Example usage for org.springframework.jdbc.core JdbcTemplate JdbcTemplate

List of usage examples for org.springframework.jdbc.core JdbcTemplate JdbcTemplate

Introduction

In this page you can find the example usage for org.springframework.jdbc.core JdbcTemplate JdbcTemplate.

Prototype

public JdbcTemplate(DataSource dataSource) 

Source Link

Document

Construct a new JdbcTemplate, given a DataSource to obtain connections from.

Usage

From source file:com.dai.dao.CompeticaoDaoImpl.java

@Override
public void apagaCompeticao(int idCompeticao) {

    String sql = "delete from competicao where idCompeticao =" + idCompeticao;
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    jdbcTemplate.update(sql);/*from w w w.ja  va 2s . c  o  m*/

}

From source file:com.dai.dao.EquipaAdversariaDaoImpl.java

@Override
public void apagaEA(int idEA) {

    String sql = "delete from equipaAdversaria where idEquipaAdversaria =" + idEA;
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    jdbcTemplate.update(sql);/*from   w  w w  . j av  a 2 s.c o  m*/

}

From source file:com.springsource.oauthservice.config.DataConfig.java

@Bean
public JdbcTemplate jdbcTemplate() {
    return new JdbcTemplate(dataSource);
}

From source file:com.electronicpanopticon.wb.shell.commands.CoreCommands.java

/**
 *
 * @return//from ww  w.  j a va2  s .  c o  m
 * @throws IOException
 */
@CliCommand(value = "ping", help = "Tests the database connection.")
public String pingCommand() throws IOException {

    JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSource);
    jdbcTemplate.execute("SELECT relname FROM pg_class WHERE pg_table_is_visible(oid);");

    return "ping";
}

From source file:com.recber.dao.UserDaoImpl.java

@Override
public List<User> getUserList() {
    List userList = new ArrayList();

    String sql = "select * from user";

    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    userList = jdbcTemplate.query(sql, new UserRowMapper());
    return userList;
}

From source file:com.grayfox.server.test.dao.jdbc.UtilJdbcDao.java

@PostConstruct
protected void init() {
    jdbcTemplate = new JdbcTemplate(dataSource);
}

From source file:de.olivergierke.spring4.java8.JdbcRepository.java

/**
 * @param template
 */
public JdbcRepository(DataSource dataSource) {
    this.template = new JdbcTemplate(dataSource);
}

From source file:Notification_Manager.Notification_TblJDBCTemplate.java

public Notification_TblJDBCTemplate() throws SQLException {
    ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
    conn = (connectivity) context.getBean("connectivity");

    this.dataSource = conn.getDataSource();
    this.jdbcTemplateObject = new JdbcTemplate(dataSource);

}

From source file:com.dai.dao.SelecaoJogoDaoImpl.java

@Override
public void apagaSL(int idUtilizador, int idJogo) {

    String sql = "delete from selecaoJogo where utilizador_idUtilizador =" + idUtilizador + "and jogo_idJogo ="
            + idJogo;//from   w  ww. j a  v  a2s.c  o m
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    jdbcTemplate.update(sql);

}

From source file:test.dao.BankDaoTest.java

@Before
public void init() {
    JdbcTemplate jdbc = new JdbcTemplate(dataSource);
    jdbc.execute("delete from banktable");
    banks = creatListOfBanks();
}