You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Geoff Chiang (JIRA)" <ib...@incubator.apache.org> on 2004/12/08 23:50:11 UTC

[jira] Commented: (IBATIS-9) Dynamic SQL from JavaBean property causes malformed SQL

     [ http://nagoya.apache.org/jira/browse/IBATIS-9?page=comments#action_56409 ]
     
Geoff Chiang commented on IBATIS-9:
-----------------------------------

This position is fine as long as you're comfortable with the inconsistency that it results in.  When it isn't a JavaBean property that is being accessed, then iBatis does arbitrarily insert the whitespace.

> Dynamic SQL from JavaBean property causes malformed SQL
> -------------------------------------------------------
>
>          Key: IBATIS-9
>          URL: http://nagoya.apache.org/jira/browse/IBATIS-9
>      Project: iBatis for Java
>         Type: Bug
>   Components: SQL Maps
>     Reporter: Clinton Begin
>     Assignee: Clinton Begin
>      Fix For: 2.0.8

>
>  If there is a 'staff' class (mapped via a typeAlias)
> with a property 'salutation' which is of type
> 'Salutation' (itself a JavaBean), then the following
> dynamic SQL fragment causes an exception to be thrown:
> <select id="searchForStaff" parameterClass="staff"
> resultMap="staffResult">
> select * from staff
> <dynamic prepend="where">
> <isNotNull prepend="and" property="lastName">last_name
> = #lastName#</isNotNull>
> <isNotNull prepend="and"
> property="salutation">salutation_id =
> #salutation.id#</isNotNull>
> </dynamic>
> </select>
> Note the access of the 'id' property of the Salutation
> JavaBean and the absence of whitespace between the
> 'isNotNull' tag and its text content (the examples in
> the tutorial and developer guide have whitespace,
> avoiding the problem).
> The exception is a SQLException stating that the SQL
> command is not properly ended. Inspection of the SQL
> shows that a space is omitted between the 'and' and the
> condition, i.e. '... andsalutation_id = ...'.
> This only occurs when it is a JavaBean property being
> accessed.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira