Example usage for org.apache.commons.dbutils QueryRunner QueryRunner

List of usage examples for org.apache.commons.dbutils QueryRunner QueryRunner

Introduction

In this page you can find the example usage for org.apache.commons.dbutils QueryRunner QueryRunner.

Prototype

public QueryRunner(DataSource ds) 

Source Link

Document

Constructor for QueryRunner that takes a DataSource to use.

Usage

From source file:com.pinterest.deployservice.db.DBPromoteDAOImpl.java

@Override
public PromoteBean getById(String envId) throws Exception {
    ResultSetHandler<PromoteBean> h = new BeanHandler<PromoteBean>(PromoteBean.class);
    return new QueryRunner(dataSource).query(GET_BY_ID, h, envId);
}

From source file:com.gs.obevo.dbmetadata.api.DbMetadataComparisonUtilTest.java

@Before
public void setup() throws Exception {
    this.ds = new BasicDataSource();
    this.ds.setDriverClassName(org.h2.Driver.class.getName());
    this.ds.setUrl(String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1", schema));
    this.ds.setUsername("sa");
    this.ds.setPassword("");

    this.jdbc = new QueryRunner(this.ds);
    this.jdbc.update("DROP SCHEMA IF EXISTS " + schema);
    this.jdbc.update("CREATE SCHEMA " + schema);

    this.metadataManager = new DbMetadataManagerImpl(dbMetadataDialect, this.ds);
    this.dbMetadataComparisonUtil = new DbMetadataComparisonUtil();
}

From source file:cn.itcast.bbs.dao.TopicDao.java

public Topic findTopicById(int id) throws SQLException {
    QueryRunner runner = new QueryRunner(JdbcUtil.getDataSource());
    String sql = "select *from topic where id = ?;";
    Topic topic = runner.query(sql, new BeanHandler(Topic.class), id);
    return topic;
}

From source file:com.pinterest.clusterservice.db.DBHostTypeDAOImpl.java

@Override
public void insert(HostTypeBean bean) throws Exception {
    SetClause setClause = bean.genSetClause();
    String clause = String.format(INSERT_HOST_TYPE, setClause.getClause());
    new QueryRunner(dataSource).update(clause, setClause.getValueArray());
}

From source file:com.pinterest.clusterservice.db.DBBaseImageDAOImpl.java

@Override
public void insert(BaseImageBean bean) throws Exception {
    SetClause setClause = bean.genSetClause();
    String clause = String.format(INSERT_IMAGE, setClause.getClause());
    new QueryRunner(dataSource).update(clause, setClause.getValueArray());
}

From source file:com.pinterest.clusterservice.db.DBPlacementDAOImpl.java

@Override
public void insert(PlacementBean bean) throws Exception {
    SetClause setClause = bean.genSetClause();
    String clause = String.format(INSERT_PLACEMENT, setClause.getClause());
    new QueryRunner(dataSource).update(clause, setClause.getValueArray());
}

From source file:com.pinterest.arcee.db.DBHealthCheckErrorDAOImpl.java

@Override
public void removeHealthCheckErrorById(String id) throws Exception {
    new QueryRunner(dataSource).update(DELETE_HRALTH_CHECK_ERROR_BY_ID, id);
}

From source file:com.pinterest.clusterservice.db.DBSecurityZoneDAOImpl.java

@Override
public void insert(SecurityZoneBean bean) throws Exception {
    SetClause setClause = bean.genSetClause();
    String clause = String.format(INSERT_NETWORK_ZONE, setClause.getClause());
    new QueryRunner(dataSource).update(clause, setClause.getValueArray());
}

From source file:com.che.software.testato.domain.dao.jdbc.adao.AbstractDAO.java

/**
 * Create and return the DbUtils QueryRuner.
 * /*w w  w .j  av  a2s .  c o  m*/
 * @author Clement HELIOU (clement.heliou@che-software.com).
 * @return the QueryRuner newly created.
 * @since July, 2011.
 */
protected QueryRunner getQueryRunner() {
    return new QueryRunner(dataSource);
}

From source file:com.pinterest.clusterservice.db.DBClusterDAOImpl.java

@Override
public void insert(ClusterBean bean) throws Exception {
    SetClause setClause = bean.genSetClause();
    String clause = String.format(INSERT_CLUSTER_CONFIG, setClause.getClause());
    new QueryRunner(dataSource).update(clause, setClause.getValueArray());
}