List of usage examples for org.springframework.jdbc.core JdbcTemplate JdbcTemplate
public JdbcTemplate(DataSource dataSource)
From source file:com.smtp.webservice.DatabaseBean.java
public void create() throws Exception { JdbcTemplate jdbc = new JdbcTemplate(dataSource); String sql = "create table orders (\n" + " id integer primary key,\n" + " item varchar(10),\n" + " amount varchar(5),\n" + " description varchar(30),\n" + " processed boolean\n" + ")"; LOG.info("Creating table orders ..."); try {//from w w w . ja va 2s . c om jdbc.execute("drop table orders"); } catch (Throwable e) { // ignore } jdbc.execute(sql); LOG.info("... created table orders"); }
From source file:com.dai.dao.EquipaAdversariaDaoImpl.java
@Override public List<EquipaAdversaria> listaEA() { List<EquipaAdversaria> eaList = new ArrayList(); String sql = "select * from equipaAdversaria"; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); eaList = jdbcTemplate.query(sql, new EquipaAdversariaRowMapper()); return eaList; }
From source file:edu.harvard.i2b2.crc.dao.setfinder.QueryPdoMasterSpringDao.java
public QueryPdoMasterSpringDao(DataSource dataSource, DataSourceLookup dataSourceLookup) { setDataSource(dataSource);// w w w. j ava 2 s . co m setDbSchemaName(dataSourceLookup.getFullSchema()); jdbcTemplate = new JdbcTemplate(dataSource); this.dataSourceLookup = dataSourceLookup; }
From source file:com.demo.camelrestsqldemo.DatabaseBean.java
public void create() throws Exception { JdbcTemplate jdbc = new JdbcTemplate(dataSource); String sql = "create table orders (\n" + " id integer primary key,\n" + " item varchar(10),\n" + " amount integer,\n" + " description varchar(30),\n" + " processed boolean\n" + ")"; LOG.info("Creating table orders ..."); try {//from w w w . j ava 2 s. c om jdbc.execute("drop table orders"); } catch (Throwable e) { // ignore } jdbc.execute(sql); LOG.info("... created table orders"); }
From source file:org.cleverbus.core.alerts.AlertsJdbcDao.java
@Autowired @Qualifier(value = "dataSource") public void setDataSource(DataSource dataSource) { Assert.notNull(dataSource, "dataSource must not be empty!"); this.template = new JdbcTemplate(dataSource); }
From source file:com.springsource.open.jms.test.DatasourceTests.java
@Autowired public void setDataSource(@Qualifier("dataSource") DataSource dataSource) { this.simpleJdbcTemplate = new JdbcTemplate(dataSource); }
From source file:edu.harvard.i2b2.crc.dao.setfinder.QueryResultTypeSpringDao.java
public QueryResultTypeSpringDao(DataSource dataSource, DataSourceLookup dataSourceLookup) { setDataSource(dataSource);//from w ww .j a v a 2 s .com setDbSchemaName(dataSourceLookup.getFullSchema()); jdbcTemplate = new JdbcTemplate(dataSource); this.dataSourceLookup = dataSourceLookup; }
From source file:com.springsource.greenhouse.members.JdbcProfileRepositoryTest.java
@Before public void setup() { db = new GreenhouseTestDatabaseBuilder().member().connectedAccount().testData(getClass()).getDatabase(); jdbcTemplate = new JdbcTemplate(db); profileRepository = new JdbcProfileRepository(jdbcTemplate, new StubFileStorage()); }
From source file:org.cloudfoundry.identity.uaa.audit.JdbcFailedLoginCountingAuditService.java
public JdbcFailedLoginCountingAuditService(DataSource dataSource) { this.template = new JdbcTemplate(dataSource); }
From source file:org.jboss.fuse.examples.jdbc.DatabaseBean.java
public void create() throws Exception { JdbcTemplate jdbc = new JdbcTemplate(dataSource); String sequence = "CREATE SEQUENCE aln_id AS int start WITH 1"; String sql = "create table ALIEN (\n" + " aln_id integer primary key,\n" + " aln_name varchar(60),\n" + " aln_fingerprint varchar(60)\n" + ")"; LOG.info("Creating table ALIEN ..."); try {//from w w w .jav a 2 s .c o m jdbc.execute("drop table ALIEN"); } catch (Throwable e) { // ignore } try { jdbc.execute("drop sequence aln_id"); } catch (Throwable e) { // ignore } jdbc.execute(sequence); jdbc.execute(sql); LOG.info("... created table ALIEN"); }