Package com.ibatis.sqlmap.client

Examples of com.ibatis.sqlmap.client.SqlMapException


  public Object valueOf(String s) {
    try {
      return format.parse(s);
    } catch (ParseException e) {
      throw new SqlMapException("Error parsing default null value date.  Format must be '" + DATE_FORMAT + "'. Cause: " + e);
    }
  }
View Full Code Here


   * @param alias - the alias
   * @param value - the real class name
   */
  public void putTypeAlias(String alias, String value) {
    if (typeAliases.containsKey(alias) && !typeAliases.get(alias).equals(value)) {
      throw new SqlMapException("Error in XmlSqlMapClientBuilder.  Alias name conflict occurred.  The alias '" + alias + "' is already mapped to the value '" + typeAliases.get(alias) + "'.");
    }
    typeAliases.put(alias, value);
  }
View Full Code Here

      this.iterator = ((Iterator) collection);
    } else if (collection.getClass().isArray()) {
      List list = arrayToList(collection);
      this.iterator = list.iterator();
    } else {
      throw new SqlMapException("ParameterObject or property was not a Collection, Array or Iterator.");
    }
  }
View Full Code Here

    }
  }

  public void setDiscriminator (Discriminator discriminator) {
    if (this.discriminator != null) {
      throw new SqlMapException ("A discriminator may only be set once per result map.");
    }
    this.discriminator = discriminator;
  }
View Full Code Here

    for (int i = 0; i < getResultMappings().length; i++) {
      BasicResultMapping mapping = (BasicResultMapping) getResultMappings()[i];
      errorContext.setMoreInfo(mapping.getErrorString());
      if (mapping.getStatementName() != null) {
        if (resultClass == null) {
          throw new SqlMapException("The result class was null when trying to get results for ResultMap named " + getId() + ".");
        } else if (Map.class.isAssignableFrom(resultClass)) {
          Class javaType = mapping.getJavaType();
          if (javaType == null) {
            javaType = Object.class;
          }
View Full Code Here

          c = new HashSet();
        } else {
          try {
            c = (Collection) type.newInstance();
          } catch (Exception e) {
            throw new SqlMapException("Error instantiating collection property for mapping '" + mapping.getPropertyName() + "'.  Cause: " + e, e);
          }
        }
        PROBE.setObject(resultObject, propertyName, c);
      }

      values = resultMap.getResults(request, request.getResultSet());
      if (request.isRowDataFound()) {
        Object o = resultMap.setResultObjectValues(request, null, values);
        if (o != NO_VALUE) {
          c.add(o);
        }
      }
    } catch (SQLException e) {
      throw new SqlMapException("Error getting nested result map values for '" + mapping.getPropertyName() + "'.  Cause: " + e, e);
    }

  }
View Full Code Here

      }
      if (value == null && nullValue != null) {
        value = typeHandler.valueOf(nullValue);
      }
    } else {
      throw new SqlMapException("No type handler could be found to map the property '" + mapping.getPropertyName() + "' to the column '" + mapping.getColumnName() + "'.  One or both of the types, or the combination of types is not supported.");
    }
    return value;
  }
View Full Code Here

            String nullValue = mapping.getNullValue();
            if ( nullValue != null )
              value = typeHandler.valueOf(nullValue);
            return value;
          } else {
            throw new SqlMapException("No type handler could be found to map the property '" + mapping.getPropertyName() + "' to the column '" + mapping.getColumnName() + "'.  One or both of the types, or the combination of types is not supported.");
          }
      }
      else  {
        return value;
      }
View Full Code Here

    return super.getResults(request, rs);
  }

  private void initialize(ResultSet rs) {
    if (getResultClass() == null) {
      throw new SqlMapException("The automatic ResultMap named " + this.getId() + " had a null result class (not allowed).");
    } else if (Map.class.isAssignableFrom(getResultClass())) {
      initializeMapResults(rs);
    } else if (getDelegate().getTypeHandlerFactory().getTypeHandler(getResultClass()) != null) {
      initializePrimitiveResults(rs);
    } else if (DomTypeMarker.class.isAssignableFrom(getResultClass())) {
View Full Code Here

        if (defaultStatementTimeout != null) {
          try {
            Integer defaultTimeout = Integer.valueOf(defaultStatementTimeout);
            vars.defaultStatementTimeout = defaultTimeout;
          } catch (NumberFormatException e) {
            throw new SqlMapException("Specified defaultStatementTimeout is not a valid integer");
          }
        }
      }
    });
  }
View Full Code Here

TOP

Related Classes of com.ibatis.sqlmap.client.SqlMapException

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.