You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Betto McRose Gamarra <ic...@gmail.com> on 2008/11/21 14:12:19 UTC

WHERE clause with full parameter condition send

hi,

well, I have a problem when I send the whole condition for the WHERE clause

this is the xml config:

    <select id="getSqlResult" resultClass="java.util.Map"
parameterClass="java.util.Map">
        <![CDATA[
            SELECT
                ID,
                $columName$ AS DESCRIPTION

            FROM
                $tableName$
        ]]>
            <dynamic prepend="WHERE">
              <isNotNull prepend="WHERE" property="condition">
                  #condition#
              </isNotNull>
            </dynamic>
    </select>

every property has a value, I could check that

the problem is because I don't have condition= #condition#
and I get this error:
ERROR [STDERR] com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the Ref.getSqlResult-InlineParameterMap.
--- Check the statement (query failed).
--- Cause: java.sql.SQLException: ORA-00920: invalid relational operator



I checked the sql string before calling to sqlExecuteQuery() method in
MappedStatement class
this is the result:

SELECT ID,  DOC_NAME AS DESCRIPTION FROM DOCUMENT WHERE ?

as you can see, the only missing part is the where clause I send

the value in the HashMap is filled, I also check that

what is the solution for this ?

-- 
Betto McRose Gamarra
IcarusDB
"Soluciones Informáticas"
Cel.: +595 992 686947

Re: WHERE clause with full parameter condition send

Posted by Betto McRose Gamarra <ic...@gmail.com>.
thanks Larry, it works

On Fri, Nov 21, 2008 at 10:32, Larry Meadors <la...@gmail.com> wrote:
> You'll have to use $condition$ instead. Be careful that you protect
> against SQL injection.
>
> Larry
>
>
> On Fri, Nov 21, 2008 at 6:12 AM, Betto McRose Gamarra
> <ic...@gmail.com> wrote:
>> hi,
>>
>> well, I have a problem when I send the whole condition for the WHERE clause
>>
>> this is the xml config:
>>
>>    <select id="getSqlResult" resultClass="java.util.Map"
>> parameterClass="java.util.Map">
>>        <![CDATA[
>>            SELECT
>>                ID,
>>                $columName$ AS DESCRIPTION
>>
>>            FROM
>>                $tableName$
>>        ]]>
>>            <dynamic prepend="WHERE">
>>              <isNotNull prepend="WHERE" property="condition">
>>                  #condition#
>>              </isNotNull>
>>            </dynamic>
>>    </select>
>>
>> every property has a value, I could check that
>>
>> the problem is because I don't have condition= #condition#
>> and I get this error:
>> ERROR [STDERR] com.ibatis.common.jdbc.exception.NestedSQLException:
>> --- The error occurred while applying a parameter map.
>> --- Check the Ref.getSqlResult-InlineParameterMap.
>> --- Check the statement (query failed).
>> --- Cause: java.sql.SQLException: ORA-00920: invalid relational operator
>>
>>
>>
>> I checked the sql string before calling to sqlExecuteQuery() method in
>> MappedStatement class
>> this is the result:
>>
>> SELECT ID,  DOC_NAME AS DESCRIPTION FROM DOCUMENT WHERE ?
>>
>> as you can see, the only missing part is the where clause I send
>>
>> the value in the HashMap is filled, I also check that
>>
>> what is the solution for this ?
>>
>> --
>> Betto McRose Gamarra
>> IcarusDB
>> "Soluciones Informáticas"
>> Cel.: +595 992 686947
>>
>



-- 
Betto McRose Gamarra
IcarusDB
"Soluciones Informáticas"
Cel.: +595 992 686947

Re: WHERE clause with full parameter condition send

Posted by Larry Meadors <la...@gmail.com>.
You'll have to use $condition$ instead. Be careful that you protect
against SQL injection.

Larry


On Fri, Nov 21, 2008 at 6:12 AM, Betto McRose Gamarra
<ic...@gmail.com> wrote:
> hi,
>
> well, I have a problem when I send the whole condition for the WHERE clause
>
> this is the xml config:
>
>    <select id="getSqlResult" resultClass="java.util.Map"
> parameterClass="java.util.Map">
>        <![CDATA[
>            SELECT
>                ID,
>                $columName$ AS DESCRIPTION
>
>            FROM
>                $tableName$
>        ]]>
>            <dynamic prepend="WHERE">
>              <isNotNull prepend="WHERE" property="condition">
>                  #condition#
>              </isNotNull>
>            </dynamic>
>    </select>
>
> every property has a value, I could check that
>
> the problem is because I don't have condition= #condition#
> and I get this error:
> ERROR [STDERR] com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred while applying a parameter map.
> --- Check the Ref.getSqlResult-InlineParameterMap.
> --- Check the statement (query failed).
> --- Cause: java.sql.SQLException: ORA-00920: invalid relational operator
>
>
>
> I checked the sql string before calling to sqlExecuteQuery() method in
> MappedStatement class
> this is the result:
>
> SELECT ID,  DOC_NAME AS DESCRIPTION FROM DOCUMENT WHERE ?
>
> as you can see, the only missing part is the where clause I send
>
> the value in the HashMap is filled, I also check that
>
> what is the solution for this ?
>
> --
> Betto McRose Gamarra
> IcarusDB
> "Soluciones Informáticas"
> Cel.: +595 992 686947
>