List of usage examples for org.springframework.jdbc.core JdbcTemplate JdbcTemplate
public JdbcTemplate(DataSource dataSource)
From source file:com.bt.aloha.sipstone.MaintenanceDao.java
public MaintenanceDao() throws Exception { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("sip.properties"); Properties dbProps = new Properties(); dbProps.load(is);//from ww w .jav a2 s . c o m BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(dbProps.getProperty("database.driverClassName", "org.postgresql.Driver")); ds.setUrl(dbProps.getProperty("database.url", "jdbc:postgresql://localhost:5432/springring")); ds.setUsername(dbProps.getProperty("database.username", "springringuser")); ds.setPassword(dbProps.getProperty("database.password", "springringuser")); this.jdbcTemplate = new JdbcTemplate(ds); }
From source file:com.googlecode.flyway.core.dbsupport.oracle.OracleDbSupportMediumTest.java
/** * Tests that the current schema for a connection is correct; *///from w w w . j ava 2s. c o m @Test public void currentSchema() { String currentSchema = new OracleDbSupport(new JdbcTemplate(dataSource)).getCurrentSchema(); assertEquals(userName.toUpperCase(), currentSchema); }
From source file:org.jasig.ssp.util.importer.job.listener.StagingTableTruncator.java
@Override public void beforeStep(StepExecution arg0) { try {//from ww w . ja v a2 s . com JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); dataSource.getConnection().setAutoCommit(true); ResultSet tables = dataSource.getConnection().getMetaData().getTables(null, null, "stg_%", new String[] { "TABLE" }); String[] exclusions = truncateExclusions == null ? new String[] {} : truncateExclusions.split(","); while (tables.next()) { stagingTables.add(tables.getString("table_name")); } for (String table : stagingTables) { if (isNotExcluded(exclusions, table)) { String sql = "truncate table " + table + ";"; jdbcTemplate.execute(sql); logger.info(sql); } } } catch (Exception e) { logger.info(e.getMessage()); } logger.info("DONE TRUNCATE"); }
From source file:com.iucosoft.eavertizare.dao.impl.FirmaDaoImpl.java
@Override public void update(Firma firma) { String query = "update firme set nume_firma=?, adresa=?, descriere=?, " + "tabela_clienti=?, mesaj_clienti=?, id_configuratie=? where id=?"; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); Object[] args = new Object[] { firma.getNumeFirma(), firma.getAdresaFirma(), firma.getDescriereFirma(), firma.getNumeFirma() + "_clienti", firma.getMesajPentruClienti(), firma.getConfiguratii().getId(), firma.getId() };/*from w ww . j ava 2 s. co m*/ jdbcTemplate.update(query, args); }
From source file:com.dai.dao.SelecaoTreinoDaoImpl.java
public List<SelecaoTreino> listaSTparaPresencas(int idTreino) { List<SelecaoTreino> stList = new ArrayList(); //String sql = "select t1.idUtilizador, t1.nomeUtilizador, t2.treino_idtreino, t2.presenca from utilizador t1 inner join selecaotreino t2 on t1.idutilizador = t2.utilizador_idutilizador_st where treino_idtreino = " + idTreino + " and presenca = null"; String sql = "select * from selecaotreino where presenca is null and treino_idTreino = " + idTreino; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); stList = jdbcTemplate.query(sql, new SelecaoTreinoRowMapper()); return stList; }
From source file:com.eheobo.samples.shiro.dao.BootstrapDataPopulator.java
public void afterPropertiesSet() throws Exception { if (isUserTableEmpty()) { //because we're using an in-memory hsqldb for the sample app, a new one will be created each time the //app starts, so insert the sample admin user at startup: JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSource); jdbcTemplate.execute(/*from w w w. j a va 2s .c o m*/ "insert into roles(id, name, description) values (1, 'user', 'The default role given to all users.')"); jdbcTemplate.execute( "insert into roles(id, name, description) values (2, 'admin', 'The administrator role only given to site admins')"); jdbcTemplate.execute("insert into roles_permissions(role_id, permissions) values (2, 'user:*')"); jdbcTemplate.execute( "insert into users(id,username,email,password) values (1, 'admin', 'sample@shiro.apache.org', '" + new Sha256Hash("admin").toHex() + "')"); jdbcTemplate.execute("insert into users_roles(users_id, roles_id) values (1, 2)"); } }
From source file:edu.harvard.i2b2.crc.dao.setfinder.QueryRequestSpringDao.java
public QueryRequestSpringDao(DataSource dataSource, DataSourceLookup dataSourceLookup) { setDataSource(dataSource);// w w w . j ava 2 s.c o m jdbcTemplate = new JdbcTemplate(dataSource); this.dataSourceLookup = dataSourceLookup; }
From source file:com.team3637.service.TagServiceMySQLImpl.java
@Override public void setDataSource(DataSource dataSource) { this.jdbcTemplateObject = new JdbcTemplate(dataSource); this.mergeTags = new SimpleJdbcCall(dataSource).withProcedureName("mergeTags"); this.deleteTag = new SimpleJdbcCall(dataSource).withProcedureName("deleteTag"); }
From source file:com.jd.survey.dao.survey.QuestionStatisticDAOImp.java
@Autowired public void setBasicDataSource(DataSource basicDataSource) { this.jdbcTemplate = new JdbcTemplate(basicDataSource); }
From source file:dk.nsi.haiba.lprimporter.dao.impl.LPRDAOImpl.java
public LPRDAOImpl(DataSource ds, String haibareplicaPrefix) { jdbcTemplate = new JdbcTemplate(ds); hr_tableprefix = haibareplicaPrefix; }