Package org.springframework.jdbc.core

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


                jdbcTemplate.queryForList("SELECT id, serializedInstance FROM ReportletConfInstance");
        for (Map<String, Object> row : rcInstances) {
            String updated = ((String) row.get("serializedInstance")).
                    replaceAll("org\\.apache\\.syncope\\.client\\.report\\.",
                    "org.apache.syncope.common.report.");
            jdbcTemplate.update("UPDATE ReportletConfInstance SET serializedInstance=? WHERE id=?",
                    new Object[] {updated, row.get("id")});
        }
    }

    private void upgradeUserRequest() {
View Full Code Here


    // make the invocation age in database, by updating it.
    DateTime dateTime = new DateTime();
    JdbcTemplate jdbcTemplate = dao.getJdbcTemplate();
    for (int days = 1; days <= 14; days++) {
      jdbcTemplate.update("update library.webservice_history set invocation_time = ?",
          new Object[]{dateTime.minusDays(days).toDate()});
      boolean isAllowed = dao.isWebserviceInvocationAllowed(similarTrack);
      boolean cacheIsInvalid = days > SIMILAR.getDaysToCache();
      assertTrue(isAllowed == cacheIsInvalid);
    }
View Full Code Here

            String value = jdbcTemplate.queryForObject(
                    "SELECT USERNAME FROM testsync WHERE ID=?", String.class, actual.getId());
            assertEquals("virattrcache", value);

            jdbcTemplate.update("UPDATE testsync set USERNAME='virattrcache2' WHERE ID=?", userTO.getId());

            value = jdbcTemplate.queryForObject(
                    "SELECT USERNAME FROM testsync WHERE ID=?", String.class, userTO.getId());
            assertEquals("virattrcache2", value);
View Full Code Here

        query.append(") VALUES (").append(values).append(')');

        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);

        try {
            jdbcTemplate.update(query.toString(), getParameters(qName, atts));
        } catch (DataAccessException e) {
            LOG.error("While trying to perform {}", query, e);
        }
    }
}
View Full Code Here

  @Transactional
  public void completeTask(String taskId) {
   
    // First insert a record in the MY_TABLE table
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    int nrOfRows = jdbcTemplate.update("insert into MY_TABLE values ('test');");
    if (nrOfRows != 1) {
      throw new RuntimeException("Insert into MY_TABLE failed");
    }
   
    taskService.complete(taskId);
View Full Code Here

            dataSource.setUrl(properties.getProperty("jdbc.url") + dataSourceName + ";DB_CLOSE_DELAY=-1");
            dataSource.setUsername(properties.getProperty("jdbc.username"));
            dataSource.setPassword(properties.getProperty("jdbc.password"));
            JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
            jdbcTemplate.execute("create table db_name (name varchar(128))");
            jdbcTemplate.update("insert into db_name values ('" + dataSourceName + "')");
        }
    }

    @Test
    public void testRoutingDataSource() throws SQLException
View Full Code Here

                getSettings(childKeys[i]).removeSettings();
            }

            // now delete all values
            JdbcTemplate template = new JdbcTemplate( dataSource );
            template.update( "DELETE FROM SETTINGS_VALUES WHERE SETTINGS_ID=?", new Object[] { id } );

            // now delete our own record
            template.update( "DELETE FROM SETTINGS WHERE ID=?", new Object[] { id } );

            id = null;
View Full Code Here

            // now delete all values
            JdbcTemplate template = new JdbcTemplate( dataSource );
            template.update( "DELETE FROM SETTINGS_VALUES WHERE SETTINGS_ID=?", new Object[] { id } );

            // now delete our own record
            template.update( "DELETE FROM SETTINGS WHERE ID=?", new Object[] { id } );

            id = null;
        }

        values.clear();
View Full Code Here

    this.dataSource = dataSource;
  }

  private void updateDatabase(String ddlRequest) {
    JdbcTemplate template=new JdbcTemplate(getDataSource());
    template.update(ddlRequest);
  }
 
  protected void onSetUp() throws Exception {
    super.onSetUp();
    updateDatabase(CREATE_SCHEMA);
View Full Code Here

    definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status=null;
    try {
      status=transactionManager.getTransaction(definition);
      JdbcTemplate template=new JdbcTemplate(getDataSource());
      template.update(UPDATE_FIELD_REQUEST,
          new Object[] {TEST_FIELD_VALUE,new Integer(FIELD_ID)},
          new int[] {Types.VARCHAR,Types.INTEGER});
      transactionManager.commit(status);
    } catch(Exception ex) {
      ex.printStackTrace();
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.