Package org.springframework.jdbc.core.simple

Examples of org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport


      nameIndex = resource.getSecondaryIndex("name");
      for (SecondaryIndex secondaryIndex : resource.getSecondaryIndexes()) {
        hive.addSecondaryIndex(resource, secondaryIndex);
      }
      hive.addNode(new Node("node", H2TestCase.TEST_DB, "", HiveDbDialect.H2));
      SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
      dao.setDataSource(hive.getDataSourceProvider().getDataSource(getConnectString(H2TestCase.TEST_DB)));
      //    dao.getJdbcTemplate().update("SET TRACE_LEVEL_SYSTEM_OUT 3");
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
View Full Code Here


      nameIndex = resource.getSecondaryIndex("name");
      for (SecondaryIndex secondaryIndex : resource.getSecondaryIndexes()) {
        hive.addSecondaryIndex(resource, secondaryIndex);
      }
      hive.addNode(new Node("node", H2TestCase.TEST_DB, "", HiveDbDialect.H2));
      SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
      dao.setDataSource(hive.getDataSourceProvider().getDataSource(getConnectString(H2TestCase.TEST_DB)));
      //    dao.getJdbcTemplate().update("SET TRACE_LEVEL_SYSTEM_OUT 3");
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
View Full Code Here

      this.uri = uri;
    }

    @SuppressWarnings("unchecked")
    public Collection<Integer> findAll(String parent) {
      SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
      dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(uri));
      return dao.getJdbcTemplate().queryForList("select id from secondary_table", Integer.class);
    }
View Full Code Here

  }

  class SecondaryMover implements Mover<Integer> {

    public void copy(Integer item, Node node) {
      SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
      dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(node.getUri()));
      dao.getJdbcTemplate().update("insert into secondary_table values (?)", new Object[]{item});
    }
View Full Code Here

      dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(node.getUri()));
      dao.getJdbcTemplate().update("insert into secondary_table values (?)", new Object[]{item});
    }

    public void delete(Integer item, Node node) {
      SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
      dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(node.getUri()));
      dao.getJdbcTemplate().update("delete from secondary_table where id = ?", new Object[]{item});
    }
View Full Code Here

      dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(node.getUri()));
      dao.getJdbcTemplate().update("delete from secondary_table where id = ?", new Object[]{item});
    }

    public Integer get(Object id, Node node) {
      SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
      dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(node.getUri()));
      return dao.getJdbcTemplate().queryForInt("select id from secondary_table where id = ?", new Object[]{id});
    }
View Full Code Here

  @Test
  public void testHiveInstall() {
    HiveConfigurationSchemaInstaller installer = new HiveConfigurationSchemaInstaller(getConnectString(TEST_DB));
    installer.run();
    JdbcDaoSupport dao = new SimpleJdbcDaoSupport();
    dao.setDataSource(getDataSource(TEST_DB));
    int rowCount = dao.getJdbcTemplate().queryForInt("select count(1) from semaphore_metadata");
    Assert.assertEquals(1, rowCount);
  }
View Full Code Here

public class TestMigration extends HiveTest {

  public void setup() {
    for (String name : getDatabaseNames()) {
      SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
      dao.setDataSource(getDataSource(getConnectString(name)));

      try {
        dao.getJdbcTemplate().update("SET DB_CLOSE_DELAY 5");
      }
      catch (Exception e) {
      } // only protection against multiple calls (create a Schema class to avoid this)
    }
  }
View Full Code Here

    NodeResolver dir = new DbDirectory(hive.getPartitionDimension(), getDataSource(getConnectString(getHiveDatabaseName())));
    PartitionKeyMover<String> pMover = new PrimaryMover(origin.getUri());
//    This mover just craps out on delete
    Mover<Integer> failingMover = new Mover<Integer>() {
      public void copy(Integer item, Node node) {
        SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
        dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(node.getUri()));
        dao.getJdbcTemplate().update("insert into secondary_table values (?)", new Object[]{item});
      }

      public void delete(Integer item, Node node) {
        throw new RuntimeException("Ach!");
      }

      public Integer get(Object id, Node node) {
        SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
        dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(node.getUri()));
        return dao.getJdbcTemplate().queryForInt("select id from secondary_table where id = ?", new Object[]{id});
      }
    };

    Migrator m = new HiveMigrator(hive);
    pMover.getDependentMovers().clear();
View Full Code Here

    public Collection<Entry<Mover, KeyLocator>> getDependentMovers() {
      return movers;
    }

    public void copy(String item, Node node) {
      SimpleJdbcDaoSupport dao = new SimpleJdbcDaoSupport();
      dao.setDataSource(CachingDataSourceProvider.getInstance().getDataSource(node.getUri()));
      dao.getJdbcTemplate().update("insert into primary_table values (?)", new Object[]{item});
    }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport

Copyright © 2018 www.massapicom. 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.