Package org.springframework.dao

Examples of org.springframework.dao.InvalidDataAccessResourceUsageException


          },
          keyHolder);
    }
    else {
      if (!this.tableMetaDataContext.isGetGeneratedKeysSimulated()) {
        throw new InvalidDataAccessResourceUsageException(
            "The getGeneratedKeys feature is not supported by this database");
      }
      if (getGeneratedKeyNames().length < 1) {
        throw new InvalidDataAccessApiUsageException("Generated Key Name(s) not specificed. " +
            "Using the generated keys features requires specifying the name(s) of the generated column(s)");
View Full Code Here


          else {
            ps = con.prepareStatement(this.actualSql, PreparedStatement.RETURN_GENERATED_KEYS);
          }
        }
        catch (AbstractMethodError ex) {
          throw new InvalidDataAccessResourceUsageException(
              "The JDBC driver is not compliant to JDBC 3.0 and thus " +
              "does not support retrieval of auto-generated keys", ex);
        }
      }
      else if (resultSetType == ResultSet.TYPE_FORWARD_ONLY && !updatableResults) {
View Full Code Here

      try {
        this.customSqlExceptionTranslator =
            (SQLExceptionTranslator) customSqlExceptionTranslatorClass.newInstance();
      }
      catch (InstantiationException e) {
        throw new InvalidDataAccessResourceUsageException(
            "Unable to instantiate " + customSqlExceptionTranslatorClass.getName(), e);
      }
      catch (IllegalAccessException e) {
        throw new InvalidDataAccessResourceUsageException(
            "Unable to instantiate " + customSqlExceptionTranslatorClass.getName(), e);
      }
    }
  }
View Full Code Here

  protected RowMapper newRowMapper(Object[] parameters, Map context) {
    try {
      return (RowMapper) rowMapperClass.newInstance();
    }
    catch (InstantiationException e) {
      throw new InvalidDataAccessResourceUsageException("Unable to instantiate RowMapper", e);
    }
    catch (IllegalAccessException e) {
      throw new InvalidDataAccessResourceUsageException("Unable to instantiate RowMapper", e);
    }
  }
View Full Code Here

    if (ex instanceof JDBCConnectionException) {
      return new DataAccessResourceFailureException(ex.getMessage(), ex);
    }
    if (ex instanceof SQLGrammarException) {
      SQLGrammarException jdbcEx = (SQLGrammarException) ex;
      return new InvalidDataAccessResourceUsageException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex);
    }
    if (ex instanceof LockAcquisitionException) {
      LockAcquisitionException jdbcEx = (LockAcquisitionException) ex;
      return new CannotAcquireLockException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex);
    }
View Full Code Here

          },
          keyHolder);
    }
    else {
      if (!this.tableMetaDataContext.isGetGeneratedKeysSimulated()) {
        throw new InvalidDataAccessResourceUsageException(
            "The getGeneratedKeys feature is not supported by this database");
      }
      if (getGeneratedKeyNames().length < 1) {
        throw new InvalidDataAccessApiUsageException("Generated Key Name(s) not specificed. " +
            "Using the generated keys features requires specifying the name(s) of the generated column(s)");
View Full Code Here

    NamedList<Object> result = new NamedList<Object>();
    try {
      result.add("json", StreamUtils.copyToString(body, Charset.forName(encoding)));
    } catch (IOException e) {
      throw new InvalidDataAccessResourceUsageException("Unable to read json from stream.", e);
    }
    return result;
  }
View Full Code Here

    super.setResponse(response);
    try {
      root = new ObjectMapper().readTree((String) getResponse().get("json"));
    } catch (Exception e) {
      throw new InvalidDataAccessResourceUsageException("Unable to parse json from response.", e);
    }
  }
View Full Code Here

      try {
        SolrSchemaRequest.create().fields(definitions).build().process(factory.getSolrServer(collectionName));
      } catch (SolrServerException e) {
        throw EXCEPTION_TRANSLATOR.translateExceptionIfPossible(new RuntimeException(e));
      } catch (IOException e) {
        throw new InvalidDataAccessResourceUsageException("Failed to write schema field definitions.", e);
      }
    }
  }
View Full Code Here

      }
      return null;
    } catch (SolrServerException e) {
      throw EXCEPTION_TRANSLATOR.translateExceptionIfPossible(new RuntimeException(e));
    } catch (IOException e) {
      throw new InvalidDataAccessResourceUsageException("Failed to load schema definition.", e);
    } catch (SolrException e) {
      throw EXCEPTION_TRANSLATOR.translateExceptionIfPossible(new RuntimeException(e));
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.dao.InvalidDataAccessResourceUsageException

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.