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.taobao.diamond.server.service.DBPersistService.java

public void setDataSource(DataSource dataSource) {
    this.jt = new JdbcTemplate(dataSource);
}

From source file:org.trendafilov.odesk.notifier.dao.CacheStateDao.java

@Autowired
public CacheStateDao(DataSource dataSource) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
}

From source file:ru.org.linux.edithistory.EditHistoryDao.java

@Autowired
public void setDataSource(DataSource dataSource) {
    jdbcTemplate = new JdbcTemplate(dataSource);

    editInsert = new SimpleJdbcInsert(dataSource).withTableName("edit_info").usingColumns("msgid", "editor",
            "oldmessage", "oldtitle", "oldtags", "oldlinktext", "oldurl", "object_type", "oldminor",
            "oldimage");

}

From source file:org.smigo.species.varieties.JdbcVarietyDao.java

@Autowired
public void setDataSource(DataSource dataSource) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
    this.insert = new SimpleJdbcInsert(dataSource).withTableName("VARIETIES").usingGeneratedKeyColumns("ID")
            .usingColumns("NAME", "USER_ID", "SPECIES_ID");
}

From source file:com.company.project.service.dao.UserDao.java

public Map<String, Object> get(String username) {
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    Map<String, Object> map = null;
    map = jdbcTemplate.queryForMap("SELECT * from users where username = ?", username);
    return map;/*www. j a  v  a 2  s .  c  o m*/
}

From source file:edu.harvard.i2b2.crc.dao.setfinder.QueryBreakdownTypeSpringDao.java

public QueryBreakdownTypeSpringDao(DataSource dataSource, DataSourceLookup dataSourceLookup) {
    setDataSource(dataSource);//  w  ww  . j  a  v a2 s.  com
    setDbSchemaName(dataSourceLookup.getFullSchema());
    jdbcTemplate = new JdbcTemplate(dataSource);
    this.dataSourceLookup = dataSourceLookup;

}

From source file:camelinaction.AtomikosXACommitTest.java

@Before
public void setupDatabase() throws Exception {
    DataSource ds = context.getRegistry().lookupByNameAndType("myDataSource", DataSource.class);
    jdbc = new JdbcTemplate(ds);

    jdbc.execute("create table partner_metric "
            + "( partner_id varchar(10), time_occurred varchar(20), status_code varchar(3), perf_time varchar(10) )");
}

From source file:com.springsource.greenhouse.account.JdbcAccountRepositoryTest.java

public JdbcAccountRepositoryTest() {
    EmbeddedDatabase db = new GreenhouseTestDatabaseBuilder().member().testData(getClass()).getDatabase();
    transactional = new Transactional(db);
    jdbcTemplate = new JdbcTemplate(db);
    AccountMapper accountMapper = new AccountMapper(new StubFileStorage(),
            "http://localhost:8080/members/{profileKey}");
    accountRepository = new JdbcAccountRepository(jdbcTemplate, NoOpPasswordEncoder.getInstance(),
            accountMapper);//from   ww w .  j  av  a 2 s  .c o m
}

From source file:de.brands4friends.daleq.integration.beans.PrepareMysqlSchema.java

@Override
public void afterPropertiesSet() throws IOException {
    final ClassPathResource script = new ClassPathResource("schema-mysql.sql");
    logger.info("Preparing Schema with file {}", script.getFile().getAbsolutePath());
    JdbcTestUtils.executeSqlScript(new JdbcTemplate(dataSource), script, false);
}

From source file:com.stehno.sjdbcx.DatabaseTestExecutionListener.java

private JdbcTemplate getJdbcTemplate(final ApplicationContext applicationContext) {
    return new JdbcTemplate(applicationContext.getBean(DataSource.class));
}