Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcTemplate$SimpleCallableStatementCreator


    protected void setUp() throws Exception {
        super.setUp();

        // create database and insert dummy data
        final DataSource ds = getMandatoryBean(DataSource.class, "dataSource");
        jdbc = new JdbcTemplate(ds);
    }
View Full Code Here


        template.execute("INSERT INTO AUTHORITIES VALUES('bob','ROLE_USER');");
        template.execute("INSERT INTO AUTHORITIES VALUES('jane','ROLE_USER');");
    }

    public void setDataSource(DataSource dataSource) {
        this.template = new JdbcTemplate(dataSource);
    }
View Full Code Here

    protected DocumentDao documentDao;

    public DataSourcePopulator(DataSource dataSource, DocumentDao documentDao) {
       Assert.notNull(dataSource, "DataSource required");
       Assert.notNull(documentDao, "DocumentDao required");
       this.template = new JdbcTemplate(dataSource);
       this.documentDao = documentDao;
    }
View Full Code Here

    //~ Constructors ===================================================================================================

    public JdbcAclService(DataSource dataSource, LookupStrategy lookupStrategy) {
        Assert.notNull(dataSource, "DataSource required");
        Assert.notNull(lookupStrategy, "LookupStrategy required");
        this.jdbcTemplate = new JdbcTemplate(dataSource);
        this.lookupStrategy = lookupStrategy;
    }
View Full Code Here

            AclAuthorizationStrategy aclAuthorizationStrategy, PermissionGrantingStrategy grantingStrategy) {
        Assert.notNull(dataSource, "DataSource required");
        Assert.notNull(aclCache, "AclCache required");
        Assert.notNull(aclAuthorizationStrategy, "AclAuthorizationStrategy required");
        Assert.notNull(grantingStrategy, "grantingStrategy required");
        jdbcTemplate = new JdbcTemplate(dataSource);
        this.aclCache = aclCache;
        this.aclAuthorizationStrategy = aclAuthorizationStrategy;
        this.grantingStrategy = grantingStrategy;
        fieldAces.setAccessible(true);
        fieldAcl.setAccessible(true);
View Full Code Here

    @BeforeClass
    public static void createDatabase() throws Exception {
        dataSource = new SingleConnectionDataSource("jdbc:hsqldb:mem:lookupstrategytest", "sa", "", true);
        dataSource.setDriverClassName("org.hsqldb.jdbcDriver");
        jdbcTemplate = new JdbcTemplate(dataSource);

        Resource resource = new ClassPathResource("createAclSchema.sql");
        String sql = new String(FileCopyUtils.copyToByteArray(resource.getInputStream()));
        jdbcTemplate.execute(sql);
    }
View Full Code Here

    public DatabaseSeeder(DataSource dataSource, Resource resource) throws IOException {
        Assert.notNull(dataSource, "dataSource required");
        Assert.notNull(resource, "resource required");

        JdbcTemplate template = new JdbcTemplate(dataSource);
        String sql = new String(FileCopyUtils.copyToByteArray(resource.getInputStream()));
        template.execute(sql);
    }
View Full Code Here

     
      source.setUsername(properties.getProperty("jdbc.username"));
      source.setPassword(properties.getProperty("jdbc.password"));
      source.setUrl(properties.getProperty("jdbc.url"));
      source.setDriverClassName(properties.getProperty("jdbc.driver"));
      jdbcTemplate = new JdbcTemplate(source);
 
      executeScript("classpath:data/h2/create-table.sql","classpath:data/h2/insert-data.sql");
      source.close();
    }
   
    //如果jetty没启动,启动jetty
    if (jettyServer == null) {
      // 设定Spring的profile
      System.setProperty(LaunchJetty.ACTIVE_PROFILE, "test");
     
      jettyServer = JettyFactory.createServerInSource(LaunchJetty.PORT, LaunchJetty.CONTEXT);
      //JettyFactory.setTldJarNames(jettyServer, LaunchJetty.TLD_JAR_NAMES);
      System.out.println("[HINT] Don't forget to set -XX:MaxPermSize=128m");
      jettyServer.start();
    }
   
    //如果当前dataSource没初始化,初始化dataSource
    if (dataSource == null) {
      dataSource = SpringContextHolder.getBean(DataSource.class);
      jdbcTemplate = new JdbcTemplate(dataSource);
    }
   
    //如果selenium没初始化,初始化selenium
    if (s == null) {
      //System.setProperty ( "webdriver.firefox.bin" , "E:/Firefox/firefox.exe" );
View Full Code Here

  private SessionFactory sessionFactory;
 
  @Autowired
  public void setDataSource(DataSource dataSource) throws Exception {
    this.dataSource = dataSource;
    this.jdbcTemplate = new JdbcTemplate(dataSource);
  }
View Full Code Here

    public void setCreateEntities(int createEntities) {
        this.createEntities = createEntities;
    }

    public void setDataSource(DataSource dataSource) {
        this.template = new JdbcTemplate(dataSource);
    }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.JdbcTemplate$SimpleCallableStatementCreator

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.