List of usage examples for org.springframework.jdbc.core JdbcTemplate JdbcTemplate
public JdbcTemplate(DataSource dataSource)
From source file:net.sourceforge.vulcan.spring.jdbc.JdbcSchemaMigratorTest.java
public void testCreateInitialTables() throws Exception { migrator.createJdbcTemplate();/*from w w w . ja v a 2s . c o m*/ migrator.createInitialTables(); int count = new JdbcTemplate(dataSource).queryForInt("select count(1) from builds"); assertEquals(0, count); }
From source file:com.dai.dao.SelecaoTreinoDaoImpl.java
@Override public void jogadorPresente(int idUtilizador, int idTreino) { String sql = "update selecaoTreino set presenca = 1 where utilizador_idUtilizador_st =" + idUtilizador + " and treino_idtreino = " + idTreino; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); jdbcTemplate.update(sql);/*from w w w. jav a 2s . c o m*/ }
From source file:uk.ac.kcl.partitioners.RealtimeTimeStampAndPKRangePartitioner.java
private ScheduledPartitionParams getParams(Timestamp jobStartTimeStamp, boolean inclusiveOfStart) { JdbcTemplate jdbcTemplate = new JdbcTemplate(sourceDataSource); String sql = "\n SELECT " + " MAX(" + column + ") AS max_id , \n" + " MIN(" + column + ") AS min_id , \n" + " MAX(" + timeStamp + ") AS max_time_stamp , \n" + " MIN(" + timeStamp + ") AS min_time_stamp \n" + " FROM ( \n" + " SELECT " + batchJobUtils.cleanSqlString(env.getProperty("partitionerPreFieldsSQL")) + " " + column + ", " + timeStamp + " FROM " + table + " "; Timestamp jobEndTimeStamp = getEndTimeStamp(jobStartTimeStamp); if (configuredFirstRunTimestamp != null && firstRun) { sql = getStartTimeInclusiveSqlString(sql, jobStartTimeStamp, jobEndTimeStamp); } else if (inclusiveOfStart) { sql = getStartTimeInclusiveSqlString(sql, jobStartTimeStamp, jobEndTimeStamp); } else if (!inclusiveOfStart) { sql = getStartTimeExclusiveSqlString(sql, jobStartTimeStamp, jobEndTimeStamp); } else {/*from w w w. j a va2 s .c o m*/ throw new RuntimeException("cannot determine parameters"); } logger.info("This job SQL: " + sql); return (ScheduledPartitionParams) jdbcTemplate.queryForObject(sql, new PartitionParamsRowMapper()); }
From source file:org.epiphanic.instrumentation.performance.HibernateWriteOperationIntegrationTest.java
License:asdf
/** * Runs any set up for our unit tests. In this case, we create a hibernate {@link org.hibernate.Session} that we can * use for grabbing mapped entities, as well as creating a {@link org.springframework.jdbc.core.JdbcTemplate} for * running queries as needed.// ww w. j av a 2 s. com */ @Before public void setUp() throws Exception { _session = _sessionFactory.openSession(); _jdbcTemplate = new JdbcTemplate(_dataSource); }
From source file:org.anon.exec.AbstractExec.java
protected void execute(String sql) { Logger.getLogger(getClass()).log(Level.DEBUG, "Executing " + sql); new JdbcTemplate(dataSource).execute(sql); }
From source file:com.tmg.fuse.poc.DatabaseBean.java
public void destroy() throws Exception { JdbcTemplate jdbc = new JdbcTemplate(dataSource); try {/*from w ww . java 2s.co m*/ jdbc.execute("drop table account"); } catch (Throwable e) { // ignore } try { jdbc.execute("drop sequence seq_xrefId"); } catch (Throwable e) { // ignore } }
From source file:com.gst.organisation.staff.service.StaffReadPlatformServiceImpl.java
@Autowired public StaffReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource) { this.context = context; this.jdbcTemplate = new JdbcTemplate(dataSource); }
From source file:com.iucosoft.eavertizare.dao.impl.FirmaDaoImpl.java
@Override public void delete(int id) { String query = "delete from firme where id=?"; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); jdbcTemplate.update(query, id);/*from w ww. j a v a 2s . c om*/ }
From source file:com.dai.dao.TreinoDaoImpl.java
@Override public List<Treino> listarTreinosEscalao(int idEscalao) { List<Treino> treinoList = new ArrayList(); String sql = "select * from treino where escalao_idEscalao_t = " + idEscalao; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); treinoList = jdbcTemplate.query(sql, new TreinoRowMapper()); return treinoList; }
From source file:co.com.jj.appform.persistence.impl.generics.DataAccesGenericImpl.java
private void setJdbcTemplate() throws Exception { if (dataSource != null) { if (jdbcTemplate == null) { jdbcTemplate = new JdbcTemplate(txManager.getDataSource()); }/*from w ww . j av a 2 s . c o m*/ } else { setDataSource(); setJdbcTemplate(); } }