Uploaded image for project: 'iBatis for Java [READ ONLY]'
  1. iBatis for Java [READ ONLY]
  2. IBATIS-786

Default Parameter replacement still 'value' instead of 'id' in some cases...

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.0 GA Candidate
    • 3.0.1 GA
    • Core
    • None
    • Java + tomcat.

    Description

      Executing arbitrary sql does not work as it should..

      <update id="upgrade_default" statementType="STATEMENT" parameterType="string">
      <![CDATA[ ${id} ]]>
      </update>

      Should handle replacement, but instead of replacing ${id} as specified, it looks for ${value}

      Error is in TextSqlNode.java line 35-37

      public String handleToken(String content) {
      try {
      Object parameter = context.getBindings().get("_parameter");
      if (parameter == null)

      { context.getBindings().put("value", null); }

      else if (SimpleTypeRegistry.isSimpleType(parameter.getClass()))

      { context.getBindings().put("value", parameter); }

      Object value = Ognl.getValue(content, context.getBindings());
      return String.valueOf(value);
      } catch (OgnlException e)

      { throw new BuilderException("Error evaluating expression '" + content + "'. Cause: " + e, e); }

      }

      Should be

      public String handleToken(String content) {
      try {
      Object parameter = context.getBindings().get("_parameter");
      if (parameter == null)

      { context.getBindings().put("id", null); }

      else if (SimpleTypeRegistry.isSimpleType(parameter.getClass()))

      { context.getBindings().put("id", parameter); }

      Object value = Ognl.getValue(content, context.getBindings());
      return String.valueOf(value);
      } catch (OgnlException e)

      { throw new BuilderException("Error evaluating expression '" + content + "'. Cause: " + e, e); }

      }

      Attachments

        Activity

          People

            cbegin Clinton Begin
            xtianstone Christian Wolfgang Stone
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: