List of usage examples for org.springframework.jdbc.core.namedparam NamedParameterJdbcTemplate NamedParameterJdbcTemplate
public NamedParameterJdbcTemplate(JdbcOperations classicJdbcTemplate)
From source file:com.gopivotal.spring.xd.module.jdbc.JdbcTasklet.java
/** * @param dataSource// w ww .j av a 2 s . c om * the dataSource to set */ public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new NamedParameterJdbcTemplate(dataSource); }
From source file:fr.acxio.tools.agia.alfresco.HibernateNodeReader.java
public void setDataSource(DataSource dataSource) { jdbcTemplate = new NamedParameterJdbcTemplate(dataSource); }
From source file:eu.europa.esig.dss.web.dao.PreferencesJdbcDao.java
/** * Set the datasource//from w w w . j a va2 s . c o m * * @param dataSource The datasource */ @Required public void setDataSource(final DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource); }
From source file:com.zousu.mongopresser.MySQLHandler.java
/** * Returns a ResultSet of entire table/*from w w w .j a v a2 s. co m*/ * * @param tableName * @return */ public SqlRowSet selectAllFromTable(String tableName) { NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(dataSource); logger.info("Calling: " + selectAllQuery + " " + tableName); return template.queryForRowSet(selectAllQuery + " " + tableName, new HashMap<String, String>()); }
From source file:com.ushahidi.swiftriver.core.api.dao.impl.JpaDropDao.java
@Autowired public void setDataSource(DataSource dataSource) { this.namedJdbcTemplate = new NamedParameterJdbcTemplate(dataSource); this.jdbcTemplate = new JdbcTemplate(dataSource); }
From source file:in.sc.dao.ProductHelper.java
public NamedParameterJdbcTemplate getTemplate() { if (namedParameterJdbcTemplate == null) { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setSchema("smart_compare"); dataSource.setUsername("root"); dataSource.setPassword("root"); // dataSource.setPassword("rose@123"); dataSource.setUrl("jdbc:mysql://localhost:3306/smart_compare"); // dataSource.setURL("jdbc:mysql://52.42.111.208:3033/smart_compare"); namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource); }//from ww w . j av a 2 s .c om return namedParameterJdbcTemplate; }
From source file:com.springsource.greenhouse.account.JdbcAccountRepository.java
public List<ProfileReference> findProfileReferencesByIds(List<Long> accountIds) { NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(jdbcTemplate); Map<String, Object> params = new HashMap<String, Object>(2, 1); params.put("accountIds", accountIds); return namedTemplate.query(AccountMapper.SELECT_ACCOUNT_REFERENCE + " where id in ( :accountIds )", params, accountMapper.getReferenceMapper()); }
From source file:com.github.dactiv.common.unit.Fixtures.java
/** * , disable./* w w w . j a v a 2 s. c o m*/ */ public static void deleteTable(DataSource h2DataSource, String... tableNames) { NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(h2DataSource); template.update("SET REFERENTIAL_INTEGRITY FALSE", new HashMap<String, Object>()); for (String tableName : tableNames) { template.update("DELETE FROM " + tableName, new HashMap<String, Object>()); } template.update("SET REFERENTIAL_INTEGRITY TRUE", new HashMap<String, Object>()); }
From source file:com.joliciel.jochre.graphics.GraphicsDaoJdbc.java
@Override public Shape loadShape(int shapeId) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_SHAPE + " FROM ocr_shape WHERE shape_id=:shape_id"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("shape_id", shapeId); LOG.debug(sql);//from w w w. jav a 2 s.c om logParameters(paramSource); Shape shape = null; try { shape = (Shape) jt.queryForObject(sql, paramSource, new ShapeMapper(this.getGraphicsServiceInternal())); } catch (EmptyResultDataAccessException ex) { ex.hashCode(); } return shape; }
From source file:io.lavagna.config.PersistenceAndServiceConfig.java
@Bean public NamedParameterJdbcTemplate simpleJdbcTemplate(Environment env, DataSource dataSource) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); // mysql does not support check constraints if ("MYSQL".equals(env.getProperty("datasource.dialect"))) { CustomSQLErrorCodesTranslator tr = new CustomSQLErrorCodesTranslator(); tr.setDataSource(dataSource);//from w ww . jav a 2s .c o m jdbcTemplate.setExceptionTranslator(tr); } return new NamedParameterJdbcTemplate(jdbcTemplate); }