Package org.springframework.dao

Examples of org.springframework.dao.TypeMismatchDataAccessException


      // Extracted value does not match already: try to convert it.
      try {
        return (T) convertValueToRequiredType(result, this.requiredType);
      }
      catch (IllegalArgumentException ex) {
        throw new TypeMismatchDataAccessException(
            "Type mismatch affecting row number " + rowNum + " and column type '" +
            rsmd.getColumnTypeName(1) + "': " + ex.getMessage());
      }
    }
    return (T) result;
View Full Code Here


      else if (Number.class.isAssignableFrom(requiredType) && Number.class.isInstance(result)) {
        try {
          result = NumberUtils.convertNumberToTargetClass(((Number) result), (Class<? extends Number>) requiredType);
        }
        catch (IllegalArgumentException ex) {
          throw new TypeMismatchDataAccessException(ex.getMessage());
        }
      }
      else {
        throw new TypeMismatchDataAccessException(
            "Result object is of type [" + result.getClass().getName() +
            "] and could not be converted to required type [" + requiredType.getName() + "]");
      }
    }
    return (T) result;
View Full Code Here

      // Extracted value does not match already: try to convert it.
      try {
        return (T) convertValueToRequiredType(result, this.requiredType);
      }
      catch (IllegalArgumentException ex) {
        throw new TypeMismatchDataAccessException(
            "Type mismatch affecting row number " + rowNum + " and column type '" +
            rsmd.getColumnTypeName(1) + "': " + ex.getMessage());
      }
    }
    return (T) result;
View Full Code Here

   * @return the value of the function
   */
  public int run(Object... parameters) {
    Object obj = super.findObject(parameters);
    if (!(obj instanceof Number)) {
      throw new TypeMismatchDataAccessException("Couldn't convert result object [" + obj + "] to int");
    }
    return ((Number) obj).intValue();
  }
View Full Code Here

    }
    if (ex instanceof InternalGemFireException) {
      return new GemfireSystemException(ex);
    }
    if (ex instanceof InvalidValueException) {
      return new TypeMismatchDataAccessException(ex.getMessage(), ex);
    }
    if (ex instanceof LeaseExpiredException) {
      return new PessimisticLockingFailureException(ex.getMessage(), ex);
    }
    if (ex instanceof LicenseException) {
View Full Code Here

        // 从  JDBC ResultSet 获取 Key
        Object key = JdbcUtils.getResultSetValue(rs, keyColumnIndex, keyType);
        if (key != null && !keyType.isInstance(key)) {
            ResultSetMetaData rsmd = rs.getMetaData();
            throw new TypeMismatchDataAccessException( // NL
                    "Type mismatch affecting row number " + rowNum + " and column type '"
                            + rsmd.getColumnTypeName(keyColumnIndex) + "' expected type is '"
                            + keyType + "'");
        }
View Full Code Here

        // 从  JDBC ResultSet 获取  Key
        Object key = JdbcUtils.getResultSetValue(rs, keyColumnIndex, keyType);
        if (key != null && !keyType.isInstance(key)) {
            ResultSetMetaData rsmd = rs.getMetaData();
            throw new TypeMismatchDataAccessException( // NL
                    "Type mismatch affecting row number " + rowNum + " and column type '"
                            + rsmd.getColumnTypeName(keyColumnIndex) + "' expected type is '"
                            + keyType + "'");
        }

        // 从  JDBC ResultSet 获取  Value
        Object value = JdbcUtils.getResultSetValue(rs, valueColumnIndex, valueType);
        if (value != null && !valueType.isInstance(value)) {
            ResultSetMetaData rsmd = rs.getMetaData();
            throw new TypeMismatchDataAccessException( // NL
                    "Type mismatch affecting row number " + rowNum + " and column type '"
                            + rsmd.getColumnTypeName(valueColumnIndex) + "' expected type is '"
                            + valueType + "'");
        }
View Full Code Here

TOP

Related Classes of org.springframework.dao.TypeMismatchDataAccessException

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.