Package com.ibatis.sqlmap.client

Examples of com.ibatis.sqlmap.client.SqlMapException


    String id = context.getStringAttribute("id");
    if (configParser.isUseStatementNamespaces()) {
      id = applyNamespace(id);
    }
    if (configParser.hasSqlFragment(id)) {
      throw new SqlMapException("Duplicate <sql>-include '" + id + "' found.");
    } else {
      configParser.addSqlFragment(id, context);
    }
  }
View Full Code Here


        return configuration.getTypeAliasRegistry().resolveAlias(resultClassName);
      } else {
        return null;
      }
    } catch (Exception e) {
      throw new SqlMapException("Error.  Could not initialize class.  Cause: " + e, e);
    }
  }
View Full Code Here

    try {
      utxName = (String) props.get("UserTransaction");
      InitialContext initCtx = new InitialContext();
      userTransaction = (UserTransaction) initCtx.lookup(utxName);
    } catch (NamingException e) {
      throw new SqlMapException("Error initializing JtaTransactionConfig while looking up UserTransaction (" + utxName + ").  Cause: " + e);
    }
  }
View Full Code Here

          mappingList.add(mapping);
          newSqlBuffer.append("?");
          token = parser.nextToken();
          if (!PARAMETER_TOKEN.equals(token)) {
            throw new SqlMapException("Unterminated inline parameter in mapped statement (" + "statement.getId()" + ").");
          }
          token = null;
        }
      } else {
        if (!PARAMETER_TOKEN.equals(token)) {
View Full Code Here

        String value = paramParser.nextToken();
        if ("javaType".equals(field)) {
          try {
            javaType = typeAliasRegistry.resolveAlias(value);
          } catch (Exception e) {
            throw new SqlMapException("Error loading javaType class");
          }
        } else if ("jdbcType".equals(field)) {
          jdbcType = JdbcType.valueOf(value);
        } else if ("mode".equals(field)) {
          parameterMode = ParameterMode.valueOf(value);
        } else if ("nullValue".equals(field)) {
          throw new UnsupportedOperationException("iBATIS 3 does not support null value substitution.");
        } else if ("handler".equals(field)) {
          try {
            Object impl = typeAliasRegistry.resolveAlias(value).newInstance();
            typeHandler = ((TypeHandler) impl);
          } catch (Exception e) {
            throw new SqlMapException("Error loading class specified by handler field in " + token + ".  Cause: " + e, e);
          }
        } else if ("numericScale".equals(field)) {
          try {
            numericScale = Integer.valueOf(value);
            if (numericScale < 0) {
              throw new SqlMapException("Value specified for numericScale must be greater than or equal to zero");
            }
          } catch (NumberFormatException e) {
            throw new SqlMapException("Value specified for numericScale is not a valid Integer");
          }
        } else {
          throw new SqlMapException("Unrecognized parameter mapping field: '" + field + "' in " + token);
        }
      } else {
        throw new SqlMapException("Incorrect inline parameter map format (missmatched name=value pairs): " + token);
      }
    }

    if (typeHandler == null) {
      if (parameterClass == null) {
View Full Code Here

        mapping.jdbcType(JdbcType.valueOf(type));
        return mapping.build();
      } else if (n1 >= 5) {
        throw new UnsupportedOperationException("iBATIS 3 does not support null value substitution.");
      } else {
        throw new SqlMapException("Incorrect inline parameter map format: " + token);
      }
    } else {
      TypeHandler handler;
      if (parameterClass == null) {
        handler = typeHandlerRegistry.getUnknownTypeHandler();
View Full Code Here

      } else {
        try {
          Class javaClass = typeAliasRegistry.resolveAlias(javaType);
          handler = typeHandlerRegistry.getTypeHandler(javaClass, jdbcType);
        } catch (Exception e) {
          throw new SqlMapException("Error.  Could not set TypeHandler.  Cause: " + e, e);
        }
      }
    } else if (typeHandlerRegistry.getTypeHandler(clazz, jdbcType) != null) {
      // Primitive
      handler = typeHandlerRegistry.getTypeHandler(clazz, jdbcType);
    } else {
      // JavaBean
      if (javaType == null) {

        Class type = MetaClass.forClass(clazz).getGetterType(propertyName);
        handler = typeHandlerRegistry.getTypeHandler(type, jdbcType);

      } else {
        try {
          Class javaClass = typeAliasRegistry.resolveAlias(javaType);
          handler = typeHandlerRegistry.getTypeHandler(javaClass, jdbcType);
        } catch (Exception e) {
          throw new SqlMapException("Error.  Could not set TypeHandler.  Cause: " + e, e);
        }
      }
    }
    return handler;
  }
View Full Code Here

            newSql.append(String.valueOf(value));
          }

          token = parser.nextToken();
          if (!ELEMENT_TOKEN.equals(token)) {
            throw new SqlMapException("Unterminated dynamic element in sql (" + sql + ").");
          }
          token = null;
        }
      } else {
        if (!ELEMENT_TOKEN.equals(token)) {
View Full Code Here

            newSql.append(String.valueOf(value));
          }

          token = parser.nextToken();
          if (!ELEMENT_TOKEN.equals(token)) {
            throw new SqlMapException("Unterminated dynamic element in sql (" + sql + ").");
          }
          token = null;
        }
      } else {
        if (!ELEMENT_TOKEN.equals(token)) {
View Full Code Here

    return preparedStatements.containsValue(ps);
  }

  public PreparedStatement getPreparedStatement(String sql) throws SQLException {
    if (!hasPreparedStatementFor(sql))
      throw new SqlMapException("Could not get prepared statement.  This is likely a bug.");
    PreparedStatement ps = (PreparedStatement) preparedStatements.get(sql);
    return ps;
  }
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.