[ 
http://issues.apache.org/jira/browse/IBATIS-282?page=comments#action_12414427 ] 

z. zhong commented on IBATIS-282:
---------------------------------

My queries were returning the wrong resultsets which were consistent with time 
constraint truncations. That occurred after I added dynamic SQL -- even when 
the dynamic SQL's preconditions were not satisfied, so I don't think it's the 
additional contraints that caused the problem.  Could I have introduced 
java.sql.Date in the process (and somehow changed it back at the same time I 
removed the dynamic SQL)?  Unlikely, but who knows.

I don't have time to craft a standalone test case that demos the problem right 
now.  Feel free to mark it as 'can't reproduce.'

thanks.

> truncation of date property values in the presence of dynamic sql
> -----------------------------------------------------------------
>
>          Key: IBATIS-282
>          URL: http://issues.apache.org/jira/browse/IBATIS-282
>      Project: iBatis for Java
>         Type: Bug

>   Components: SQL Maps
>     Versions: 2.1.7
>  Environment: linux, mysql, java 1.5
>     Reporter: z. zhong
>  Attachments: test.zip
>
> strange interaction between Java.util.Date parameters and dynamic sql.
> query 1:
>     select
>         ...
>     where
>          ...
>          and rd.event_time       <= #endTime#
> the generated SQL is
>         ...
>         and rd.event_time       <= '2006-03-30 18:33:46'
>         
> so far so good.
> query 2:
> just add an extra dynamic sql at the end:
>     select
>         ...
>     where
>          ...
>                  and rd.event_time       &lt;= #endTime#
>                   <iterate prepend="and" property="done" open=" 
> rd.is_complete in (" conjunction="," close = ")">#done[]#</iterate>
>         
> and the SQL becomes
>         ...
>         and rd.event_time       <= '2006-03-30'
>         and ...
> The date value has been truncated.
> Notes:
> * i've tried other dynamic sql elements: isNotEmpty, etc., and got the same 
> problem.
> * insert seems to work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to