Example usage for org.springframework.jdbc.core.namedparam NamedParameterJdbcTemplate NamedParameterJdbcTemplate

List of usage examples for org.springframework.jdbc.core.namedparam NamedParameterJdbcTemplate NamedParameterJdbcTemplate

Introduction

In this page you can find the example usage for org.springframework.jdbc.core.namedparam NamedParameterJdbcTemplate NamedParameterJdbcTemplate.

Prototype

public NamedParameterJdbcTemplate(JdbcOperations classicJdbcTemplate) 

Source Link

Document

Create a new NamedParameterJdbcTemplate for the given classic Spring org.springframework.jdbc.core.JdbcTemplate .

Usage

From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java

@Override
public void deleteTextItem(int textItemId) {
    NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource());
    MapSqlParameterSource paramSource = new MapSqlParameterSource();
    String sql = "DELETE FROM ftb_text WHERE text_id = :text_id";
    paramSource.addValue("text_id", textItemId);
    LOG.info(sql);/*from  w  ww.java2 s  .c o  m*/
    TreebankDaoImpl.LogParameters(paramSource);
    jt.update(sql, paramSource);
}

From source file:com.disney.opa.dao.impl.ProductDaoImpl.java

public void setDataSource(DataSource dataSource) {
    namedJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
}

From source file:org.anyframe.iam.core.assist.impl.ResourceAssistDAO.java

public void setDataSource(DataSource dataSource) {
    namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
}

From source file:org.apache.ctakes.ytex.kernel.ImputedFeatureEvaluatorImpl.java

public void setDataSource(DataSource ds) {
    this.jdbcTemplate = new JdbcTemplate(ds);
    this.namedParamJdbcTemplate = new NamedParameterJdbcTemplate(ds);
}

From source file:org.apache.ctakes.ytex.kernel.SparseDataExporterImpl.java

public void setDataSource(DataSource ds) {
    this.jdbcTemplate = new JdbcTemplate(ds);
    this.simpleJdbcTemplate = new SimpleJdbcTemplate(ds);
    this.namedJdbcTemplate = new NamedParameterJdbcTemplate(ds);
}

From source file:org.apache.ctakes.ytex.uima.DBCollectionReader.java

protected void initDB(String dbDriver, String dbURL) throws ResourceInitializationException {
    if (dbURL != null && dbURL.length() > 0) {
        try {//w  ww  .j  av  a  2s  .co  m

            if (dbDriver == null || dbDriver.length() == 0) {
                dbDriver = ApplicationContextHolder.getYtexProperties().getProperty("db.driver");
            }
            dataSource = new SimpleDriverDataSource((Driver) Class.forName(dbDriver).newInstance(), dbURL);
            txTemplate = new TransactionTemplate(new DataSourceTransactionManager(dataSource));
        } catch (InstantiationException e) {
            throw new ResourceInitializationException(e);
        } catch (IllegalAccessException e) {
            throw new ResourceInitializationException(e);
        } catch (ClassNotFoundException e) {
            throw new ResourceInitializationException(e);
        }
    } else {
        txTemplate = (TransactionTemplate) ApplicationContextHolder.getApplicationContext()
                .getBean("txTemplate");
        dataSource = (DataSource) ApplicationContextHolder.getApplicationContext()
                .getBean("collectionReaderDataSource");
    }
    simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
    namedJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
}

From source file:org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformServiceImpl.java

@Autowired
public LoanReadPlatformServiceImpl(final PlatformSecurityContext context, final LoanRepository loanRepository,
        final LoanTransactionRepository loanTransactionRepository,
        final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepository,
        final LoanProductReadPlatformService loanProductReadPlatformService,
        final ClientReadPlatformService clientReadPlatformService,
        final GroupReadPlatformService groupReadPlatformService,
        final LoanDropdownReadPlatformService loanDropdownReadPlatformService,
        final FundReadPlatformService fundReadPlatformService,
        final ChargeReadPlatformService chargeReadPlatformService,
        final CodeValueReadPlatformService codeValueReadPlatformService, final RoutingDataSource dataSource,
        final CalendarReadPlatformService calendarReadPlatformService,
        final StaffReadPlatformService staffReadPlatformService,
        final PaymentTypeReadPlatformService paymentTypeReadPlatformService,
        final LoanRepaymentScheduleTransactionProcessorFactory loanRepaymentScheduleTransactionProcessorFactory,
        final FloatingRatesReadPlatformService floatingRatesReadPlatformService,
        final LoanUtilService loanUtilService) {
    this.context = context;
    this.loanRepository = loanRepository;
    this.loanTransactionRepository = loanTransactionRepository;
    this.applicationCurrencyRepository = applicationCurrencyRepository;
    this.loanProductReadPlatformService = loanProductReadPlatformService;
    this.clientReadPlatformService = clientReadPlatformService;
    this.groupReadPlatformService = groupReadPlatformService;
    this.loanDropdownReadPlatformService = loanDropdownReadPlatformService;
    this.fundReadPlatformService = fundReadPlatformService;
    this.chargeReadPlatformService = chargeReadPlatformService;
    this.codeValueReadPlatformService = codeValueReadPlatformService;
    this.calendarReadPlatformService = calendarReadPlatformService;
    this.staffReadPlatformService = staffReadPlatformService;
    this.jdbcTemplate = new JdbcTemplate(dataSource);
    this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
    this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
    this.loanRepaymentScheduleTransactionProcessorFactory = loanRepaymentScheduleTransactionProcessorFactory;
    this.floatingRatesReadPlatformService = floatingRatesReadPlatformService;
    this.loanUtilService = loanUtilService;
}

From source file:org.apereo.portal.jgroups.protocols.JdbcPingDao.java

public void setJdbcOperations(JdbcOperations jdbcOperations) {
    this.jdbcOperations = jdbcOperations;
    this.namedParameterJdbcOperations = new NamedParameterJdbcTemplate(this.jdbcOperations);
}

From source file:org.cloudfoundry.identity.uaa.resources.jdbc.AbstractQueryable.java

protected AbstractQueryable(JdbcTemplate jdbcTemplate, JdbcPagingListFactory pagingListFactory,
        RowMapper<T> rowMapper) {
    this.jdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
    this.pagingListFactory = pagingListFactory;
    this.rowMapper = rowMapper;
}

From source file:org.cloudfoundry.identity.uaa.scim.jdbc.JdbcScimGroupExternalMembershipManager.java

@Override
public int delete(String filter) {
    SearchQueryConverter.ProcessedFilter where = getQueryConverter().convert(filter, null, false);
    logger.debug("Filtering groups with SQL: " + where);
    try {/*from   w w  w  .  ja v a2 s  .  c o m*/
        String completeSql = "DELETE FROM " + getTableName() + " WHERE ";
        if (StringUtils.hasText(where.getSql())) {
            completeSql += where.getSql() + " AND ";
        }
        completeSql += "group_id IN (SELECT id FROM groups WHERE identity_zone_id='"
                + IdentityZoneHolder.get().getId() + "')";
        logger.debug("delete sql: " + completeSql + ", params: " + where.getParams());
        return new NamedParameterJdbcTemplate(jdbcTemplate).update(completeSql, where.getParams());
    } catch (DataAccessException e) {
        logger.debug("Filter '" + filter + "' generated invalid SQL", e);
        throw new IllegalArgumentException("Invalid delete filter: " + filter);
    }
}