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() 

Source Link

Document

Construct a new JdbcTemplate for bean usage.

Usage

From source file:com.thesoftwareguild.flightmaster.configuration.DaoConfig.java

@Bean
public JdbcTemplate jdbcTemplate() {
    jdbcTemplate = new JdbcTemplate();
    jdbcTemplate.setDataSource(datasource);
    return jdbcTemplate;
}

From source file:com.nortal.petit.orm.statement.DeleteStatementTest.java

@Test
public void test__impliedSqlCreatedEqual() {
    UpdateStmtBean bean = UpdateStatementFixture.getDefaultBean();
    bean.setId(1L);/*  w w  w  .jav  a2  s.  com*/
    bean.setDescription("DESC");

    DeleteStatement<UpdateStmtBean> update1 = new DeleteStatement<UpdateStmtBean>(new JdbcTemplate(),
            new OracleStatementBuilder(), bean);
    update1.setBy("description");

    DeleteStatement<UpdateStmtBean> update2 = new DeleteStatement<UpdateStmtBean>(new JdbcTemplate(),
            new OracleStatementBuilder(), UpdateStmtBean.class);
    update2.setBy("description").setBeans(Arrays.asList(bean));

    DeleteStatement<UpdateStmtBean> update3 = new DeleteStatement<UpdateStmtBean>(new JdbcTemplate(),
            new OracleStatementBuilder(), bean);
    update3.setBy("description").where(Where.eq("id", 1L));

    System.out.println(update1.getSqlWithParams());
    System.out.println(update2.getSqlWithParams());
    System.out.println(update3.getSqlWithParams());

    MatcherAssert.assertThat(update1.getSqlWithParams(), Matchers.equalTo(update2.getSqlWithParams()));
    MatcherAssert.assertThat(update1.getSqlWithParams(), Matchers.equalTo(update3.getSqlWithParams()));
}