Package com.ibatis.sqlmap.client

Examples of com.ibatis.sqlmap.client.SqlMapException


  public void putPreparedStatement(SqlMapExecutorDelegate delegate, String sql, PreparedStatement ps) {
    if (delegate.isStatementCacheEnabled()) {
      if (!isInBatch()) {
        if (hasPreparedStatementFor(sql))
          throw new SqlMapException("Duplicate prepared statement found.  This is likely a bug.");
        preparedStatements.put(sql, ps);
      }
    }
  }
View Full Code Here


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

   *
   * @param ms - the mapped statement to add
   */
  public void addMappedStatement(MappedStatement ms) {
    if (mappedStatements.containsKey(ms.getId())) {
      throw new SqlMapException("There is already a statement named " + ms.getId() + " in this SqlMap.");
    }
    ms.setBaseCacheKey(hashCode());
    mappedStatements.put(ms.getId(), ms);
  }
View Full Code Here

   * @return - the mapped statement
   */
  public MappedStatement getMappedStatement(String id) {
    MappedStatement ms = (MappedStatement) mappedStatements.get(id);
    if (ms == null) {
      throw new SqlMapException("There is no statement named " + id + " in this SqlMap.");
    }
    return ms;
  }
View Full Code Here

   * @return - the cache model
   */
  public CacheModel getCacheModel(String id) {
    CacheModel model = (CacheModel) cacheModels.get(id);
    if (model == null) {
      throw new SqlMapException("There is no cache model named " + id + " in this SqlMap.");
    }
    return model;
  }
View Full Code Here

   * @return - the result map
   */
  public ResultMap getResultMap(String id) {
    ResultMap map = (ResultMap) resultMaps.get(id);
    if (map == null) {
      throw new SqlMapException("There is no result map named " + id + " in this SqlMap.");
    }
    return map;
  }
View Full Code Here

   * @return - the parameter map
   */
  public ParameterMap getParameterMap(String id) {
    ParameterMap map = (ParameterMap) parameterMaps.get(id);
    if (map == null) {
      throw new SqlMapException("There is no parameter map named " + id + " in this SqlMap.");
    }
    return map;
  }
View Full Code Here

    for (int i = 0; i < getResultMappings().length; i++) {
      ResultMapping mapping = (ResultMapping) 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

          if (Collection.class.isAssignableFrom(type)) {
            obj = ResultObjectFactoryUtil.createObjectThroughFactory(type);
            PROBE.setObject(resultObject, propertyName, obj);
          }
        } catch (Exception e) {
          throw new SqlMapException("Error instantiating collection property for mapping '" + mapping.getPropertyName() + "'.  Cause: " + e, e);
        }
      }

      values = resultMap.getResults(statementScope, statementScope.getResultSet());
      if (statementScope.isRowDataFound()) {
        Object o = resultMap.setResultObjectValues(statementScope, null, values);
        if (o != NO_VALUE) {
          if (obj != null && obj instanceof Collection) {
            ((Collection) obj).add(o);
          } else {
            PROBE.setObject(resultObject, propertyName, o);
          }
        }
      }
    } catch (SQLException e) {
      throw new SqlMapException("Error getting nested result map values for '" + mapping.getPropertyName() + "'.  Cause: " + e, e);
    }
  }
View Full Code Here

        value = typeHandler.getResult(rs, columnIndex);
      } else {
        value = typeHandler.getResult(rs, columnName);
      }
    } 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

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.