Package org.springframework.jdbc.core.simple

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


   private SimpleJdbcInsert bookInsert;

   @Autowired(required = true)
   public void initialize(final DataSource dataSource) {
      this.jdbcTemplate = new SimpleJdbcTemplate(dataSource);
      this.bookInsert = new SimpleJdbcInsert(dataSource).withTableName("books")
               .usingGeneratedKeyColumns("id");
   }
View Full Code Here


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

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

        DataSource dataSource = new SimpleDriverDataSource(new Driver(), URL, USERNAME, PASSWORD);
        migrationManager = new DataSourceMigrationManager(dataSource);
        migrationManager.setMigrationResolver(new ResourceMigrationResolver("classpath:/test_migrations/mysql_50/"));

        jdbcTemplate = new SimpleJdbcTemplate(dataSource);
    }
View Full Code Here

    public void testRoutingDataSource() throws SQLException
    {
        for (String dataSourceName : dataSourceNames)
        {
            contextService.setCurrentClient(dataSourceName);
            SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(dataSource);
            String name = jdbcTemplate.queryForObject("select name from db_name", String.class, Collections.EMPTY_MAP);
            assertThat(name, is(dataSourceName));
        }
    }
View Full Code Here

        if (person == null) {
            String msg = "Argument 'person' cannot be null.";
            throw new IllegalArgumentException(msg);
        }
       
        final SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(RDBMServices.getDataSource());
        final int struct_count = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM up_layout_struct WHERE user_id = ?", person.getID());
        return struct_count == 0 ? false : true;
       
    }
View Full Code Here

        int nextId = 1;
        for (Iterator<org.dom4j.Element> it = (Iterator<org.dom4j.Element>) layout.selectNodes("folder | dlm:*").iterator(); it.hasNext();) {
            nextId = addIdAttributesIfNecessary(it.next(), nextId);
        }
        // Now update UP_USER...
        final SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(RDBMServices.getDataSource());
        jdbcTemplate.update("UPDATE up_user SET next_struct_id = ? WHERE user_id = ?", nextId, person.getID());

        // (4) Convert external DLM pathrefs to internal form (noderefs)...
        for (Iterator<org.dom4j.Attribute> itr = (Iterator<org.dom4j.Attribute>) layout.selectNodes("//@dlm:origin").iterator(); itr.hasNext();) {
            org.dom4j.Attribute a = itr.next();
            String noderef = getDlmNoderef(ownerUsername, a.getValue(), null, true, layout);
View Full Code Here

     * The DataSource to use for counter generation
     */
    @Required
    public void setDataSource(DataSource dataSource) {
        Validate.notNull(dataSource);
        this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
    }
View Full Code Here

   /* (non-javadoc)
    * @see org.jasig.portal.IUserIdentityStore#getPortalUserName(int)
    */
   public String getPortalUserName(final int uPortalUID) {
       final DataSource dataSource = RDBMServices.getDataSource();
       final SimpleJdbcTemplate simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);

       final List<String> results = simpleJdbcTemplate.query("SELECT USER_NAME FROM UP_USER WHERE USER_ID=?", this.userNameRowMapper, uPortalUID);
       final String userName = (String)DataAccessUtils.singleResult(results);
       return userName;
   }
View Full Code Here

      try {
        conn = this.dataSource.getConnection();
        //The order of these tests is IMPORTANT, each may depend on the
        //results of the previous tests.
        this.getMetaData(conn);
        final SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(this.dataSource);
       
        this.testDatabaseInitialized(jdbcTemplate);
        if (this.portalTablesExist) {
            this.testOuterJoins(jdbcTemplate);
            this.testTimeStamp(jdbcTemplate);
View Full Code Here

    /**
     * @param dataSource the dataSource to set
     */
    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
        this.simpleJdbcTemplate = new SimpleJdbcTemplate(this.dataSource);
    }
View Full Code Here

TOP

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

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.