Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcTemplate.query()


      selectAllStatementToUse = strat.createSelectAllStatement();

      Dao.selectAllStatements.put(type, selectAllStatementToUse);
    }

    List<T> results = select.query(selectAllStatementToUse,
        new Object[] {}, new TemplateRowMapper<T>(type));

    return results;

  }
View Full Code Here


    final int counter[] = new int[1];
    counter[0] = 0;
    final JdbcTemplate jdbc = new JdbcTemplate(getDataSource());
    try {
      String sql = " from t_history_property_delta where old_value like 'org.projectforge.%' or new_value like 'org.projectforge.%'";
      jdbc.query("select id, old_value, new_value, property_type" + sql, new ResultSetExtractor() {
        @Override
        public Object extractData(final ResultSet rs) throws SQLException, DataAccessException
        {
          while (rs.next() == true) {
            final int id = rs.getInt("ID");
View Full Code Here

      int no = jdbc.queryForInt("select count(*)" + sql);
      if (no > 0) {
        log.warn("" + no + " of data base history entries aren't fixed.");
      }
      sql = " from t_history_property_delta where property_type like '%_$$_javassist_%'";
      jdbc.query("select id, property_type" + sql, new ResultSetExtractor() {
        @Override
        public Object extractData(final ResultSet rs) throws SQLException, DataAccessException
        {
          while (rs.next() == true) {
            final int id = rs.getInt("ID");
View Full Code Here

  }

  public List<Resource> loadAll() {
    JdbcTemplate t = getJdbcTemplate();
    ArrayList<Resource> results = new ArrayList<Resource>();
    for (Object si : t.query("SELECT * FROM resource_metadata",
        new ResourceRowMapper())) {
     
      results.add((Resource)si);
    }
    return results;
View Full Code Here

  }

  public List<Resource> findByDimension(int id) {
    JdbcTemplate t = getJdbcTemplate();
    ArrayList<Resource> results = new ArrayList<Resource>();
    for (Object r : t.query("SELECT * FROM resource_metadata WHERE dimension_id = ?",
        new Object[] { id },
        new ResourceRowMapper())) {
      results.add((Resource) r);
    }
    return results;
View Full Code Here

  }

  public List<SecondaryIndex> loadAll() {
    JdbcTemplate t = getJdbcTemplate();
    ArrayList<SecondaryIndex> results = new ArrayList<SecondaryIndex>();
    for (Object si : t.query("SELECT * FROM secondary_index_metadata",
        new SecondaryIndexRowMapper())) {
      results.add((SecondaryIndex) si);
    }
    return results;
  }
View Full Code Here

  }

  public List<SecondaryIndex> findByResource(int id) {
    JdbcTemplate t = getJdbcTemplate();
    ArrayList<SecondaryIndex> results = new ArrayList<SecondaryIndex>();
    for (Object si : t.query("SELECT * FROM secondary_index_metadata WHERE resource_id = ?",
        new Object[] { id },
        new SecondaryIndexRowMapper())) {
      results.add((SecondaryIndex) si);
    }
    return results;
View Full Code Here

   * @return
   */
  public static boolean tableExists(String tableName, String uri) {
    JdbcTemplate t = new JdbcTemplate(CachingDataSourceProvider.getInstance().getDataSource(uri));
    try {
      t.query( "select * from " + tableName + ifMySql(" LIMIT 1",DriverLoader.discernDialect(uri)), new TrueRowMapper());
      return true;
    }
    catch (Exception e) {
      return false;
    }
View Full Code Here

  }

  public List<PartitionDimension> loadAll() {
    JdbcTemplate t = getJdbcTemplate();
    ArrayList<PartitionDimension> results = new ArrayList<PartitionDimension>();
    for (Object result : t.query("SELECT * FROM partition_dimension_metadata",
      new PartitionDimensionRowMapper())) {
      PartitionDimension dimension = (PartitionDimension) result;
      results.add(dimension);
    }
    return results;
View Full Code Here

  @SuppressWarnings("unchecked")
  public PartitionDimension get() {
    JdbcTemplate t = getJdbcTemplate();
    ArrayList<PartitionDimension> results =
      (ArrayList<PartitionDimension>) t.query("SELECT * FROM partition_dimension_metadata", new PartitionDimensionRowMapper());

    if (results.size() == 0)
      throw new HiveRuntimeException("No PartitionDimension found.");
    else if (results.size() > 1)
      throw new HiveRuntimeException(String.format("Found %s PartitionDImensions, there can be only one.", results.size()));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.