Examples of queryForInt()


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

    log.info("Initializing StatisticsCache ...");
    numberOfEntitiesMap = new HashMap<Class< ? extends BaseDO< ? >>, Integer>();
    final JdbcTemplate jdbc = new JdbcTemplate(dataSource);
    for (final RegistryEntry registryEntry : Registry.instance().getOrderedList()) {
      try {
        final int number = jdbc.queryForInt("SELECT COUNT(*) FROM " + HibernateUtils.getDBTableName(registryEntry.getDOClass()));
        numberOfEntitiesMap.put(registryEntry.getDOClass(), number);
      } catch (final Exception ex) {
        log.error(ex.getMessage(), ex);
        continue;
      }
View Full Code Here

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

  public boolean isAdminUser(final PFUserDO user)
  {
    final JdbcTemplate jdbc = new JdbcTemplate(dataSource);
    String sql = "select pk from t_group where name=?";
    final int adminGroupId = jdbc.queryForInt(sql, new Object[] { ProjectForgeGroup.ADMIN_GROUP.getKey()});
    sql = "select count(*) from t_group_user where group_id=? and user_id=?";
    final int count = jdbc.queryForInt(sql, new Object[] { adminGroupId, user.getId()});
    if (count != 1) {
      log.info("Admin login for maintenance (data-base update) failed for user '"
          + user.getUsername()
View Full Code Here

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

  {
    final JdbcTemplate jdbc = new JdbcTemplate(dataSource);
    String sql = "select pk from t_group where name=?";
    final int adminGroupId = jdbc.queryForInt(sql, new Object[] { ProjectForgeGroup.ADMIN_GROUP.getKey()});
    sql = "select count(*) from t_group_user where group_id=? and user_id=?";
    final int count = jdbc.queryForInt(sql, new Object[] { adminGroupId, user.getId()});
    if (count != 1) {
      log.info("Admin login for maintenance (data-base update) failed for user '"
          + user.getUsername()
          + "' (user not member of admin group).");
      return false;
View Full Code Here

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

   */
  int internalGetOpenEntries(final Integer userId)
  {
    final JdbcTemplate jdbc = new JdbcTemplate(dataSource);
    try {
      return jdbc.queryForInt("SELECT COUNT(*) FROM "
          + table.getName()
          + " where assignee_fk="
          + userId
          + " and recent=true and deleted=false");
    } catch (final Exception ex) {
View Full Code Here

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

        assertTrue(userTO.getPropagationTOs().isEmpty());

        Exception exception = null;
        try {
            jdbcTemplate.queryForInt("SELECT id FROM test WHERE id=?", userTO.getUsername());
        } catch (EmptyResultDataAccessException e) {
            exception = e;
        }
        assertNotNull(exception);
View Full Code Here

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

    String configName = "";
    String testSql = TAtomDataSourceUnitTest.TEST_SQL;
    configName = dbType;
    TAtomDataSource tAtomDataSource = createTAtomDataSource(appName, dbKey, configName);
    JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
    int actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    //���ô����IP��������
    //ȫ������
    String globaStr = PropLoadTestUtil.loadPropFile2String("conf/" + configName + "/globa.properties");
    MockServer.setConfigInfo(TAtomConstants.getGlobalDataId(dbKey), globaStr);
View Full Code Here

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

    MockServer.setConfigInfo(passwdDataId, PropLoadTestUtil.convertProp2Str(change.doChange(passwdProp)));
    Thread.sleep(1200);
    //�ڴ����ִ���
    boolean result = false;
    try {
      actual = jtp.queryForInt(testSql);
    } catch (Throwable e) {
      result = true;
    }
    Assert.assertTrue(result);
    MockServer.setConfigInfo(
View Full Code Here

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

        passwdDataId,
        PropLoadTestUtil.convertProp2Str(restore.doChange(PropLoadTestUtil.loadPropFromFile("conf/"
            + configName + "/psswd.properties"))));
    Thread.sleep(1200);
    //�ڴ��������
    actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    tAtomDataSource.destroyDataSource();

  }
View Full Code Here

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

    String configName = dbType;
    String testSql = TAtomDataSourceUnitTest.TEST_SQL;
    ;
    TAtomDataSource tAtomDataSource = createTAtomDataSource(appName, dbKey, configName);
    JdbcTemplate jtp = new JdbcTemplate(tAtomDataSource);
    int actual = jtp.queryForInt(testSql);
    Assert.assertEquals(actual, 1);
    //���ô����IP��������
    String fileName = "";
    String dataId = "";
    if (type.equals("globa")) {
View Full Code Here

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

    MockServer.setConfigInfo(dataId, PropLoadTestUtil.convertProp2Str(change.doChange(prop)));
    Thread.sleep(3000);
    //�ڴ����ִ���
    boolean result = false;
    try {
      actual = jtp.queryForInt(testSql);
    } catch (Throwable e) {
      result = true;
    }
    Assert.assertTrue(result);
    MockServer.setConfigInfo(
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.