List of usage examples for org.springframework.jdbc.core JdbcTemplate JdbcTemplate
public JdbcTemplate(DataSource dataSource)
From source file:camelinaction.OrderCreateTable.java
public OrderCreateTable(CamelContext camelContext) { DataSource ds = camelContext.getRegistry().lookupByNameAndType("myDataSource", DataSource.class); JdbcTemplate jdbc = new JdbcTemplate(ds); try {//from w w w . j a v a2 s . c o m jdbc.execute("drop table riders_order"); } catch (Exception e) { // ignore as the table may not already exists } jdbc.execute("create table riders_order " + "( customer_id varchar(10), ref_no varchar(10), part_id varchar(10), amount varchar(10) )"); }
From source file:com.univocity.articles.databases.HsqlDatabase.java
@Override public void applyDatabaseSpecificConfiguration(JdbcDataStoreConfiguration jdbcDataStoreConfig) { /*/*w w w .j av a 2s. c o m*/ * Shuts down HSQLDB after executing the data migration processes. */ Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { new JdbcTemplate(getDataSource()).execute("SHUTDOWN"); } }); }
From source file:com.test.springmvc.springmvcproject.dao.UtilisateurDAOImpl.java
@Autowired public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; this.template = new JdbcTemplate(dataSource); }
From source file:com.ignite.dao.AccountDao.java
public List<Account> getAccountsForClient(Client client) { logger.info("Getting clients"); JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); List<Account> products = jdbcTemplate.query( "select id, client, balance from account where client=" + "'" + client.getLogin() + "'", new AccountMapper()); return products; }
From source file:org.hbird.business.archive.jdbc.Archiver.java
/** * The Constructor/*from w w w .j a v a2 s. com*/ * * @param database * The database to store the parameters in. */ public Archiver(DataSource database) { template = new JdbcTemplate(database); }
From source file:com.ge.predix.acs.monitoring.AcsMonitoringRepository.java
@Autowired public void setDataSource(final DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); }
From source file:camelinaction.OrderDAO.java
public void insertOrder(InputOrder order, Registry registry) { DataSource ds = registry.lookupByNameAndType("myDataSource", DataSource.class); JdbcTemplate jdbc = new JdbcTemplate(ds); Object[] args = new Object[] { order.getCustomerId(), order.getRefNo(), order.getPartId(), order.getAmount() };//from w w w . j a v a 2 s. c o m jdbc.update("insert into riders_order (customer_id, ref_no, part_id, amount) values (?, ?, ?, ?)", args); }
From source file:com.dai.dao.JogoDaoImpl.java
@Override public List<Jogo> listaJogosPendentes() { List<Jogo> utList = new ArrayList(); String sql = "select * from jogo where resultadoJogo is null"; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); utList = jdbcTemplate.query(sql, new JogoRowMapper()); return utList; }
From source file:com.apress.prospringintegration.springenterprise.stocks.dao.jdbc.StocksJdbcConfig.java
@Bean public JdbcTemplate jdbcTemplate() { return new JdbcTemplate(dataSource()); }
From source file:com.ignite.dao.ClientDao.java
@PreAuthorize("hasRole('ROLE_TELLER')") public Client getClient(String username) { logger.info("Getting client"); JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); List<Client> products = jdbcTemplate.query( "select firstname, lastname, username, pid from users where username=" + "'" + username + "" + "'", new ClientMapper()); return products.get(0); }