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 Jeremy Jardin <je...@gmail.com> on 2010/05/04 17:11:56 UTC
date in where clause does not work.
Hi,
I'm simply trying to build a request with Date comparaisons.. and ibatis
still reply me empty list..
My generated request in logs :
DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {conn-100000}
Connection
DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {conn-100000}
Preparing Statement: select * from TAB_CHIF where (DAT_CHIF
>?)order by DAT_CHIF
DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
Executing Statement: select * from TAB_CHIF where (DAT_CHIF
>?)order by DAT_CHIF
DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
Parameters: [2010-05-04]
DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
Types: [java.sql.Date]
If I launch handly the same request (with a date parsing) in my oracle
client, there's one row.
select * from TAB_CHIF where(DAT_CHIF > to_date('2010-05-04',
'yyyy-MM-dd'));
I guess I've got a dateFormat matter.. but what's the workaround ?
Thanks.
Jeremy
--
View this message in context: http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28447759.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: date in where clause does not work.
Posted by Jeff Butler <je...@gmail.com>.
(a)ibator converts these to java.sql.Date to force iBATIS to use the
DateOnlyTypeHandler for database fields that are truly just dates -
not date/time or timestamp. This is working in lots of tests.
What is the type of the database field? Is it truly just a date, or
is it a timestamp?
Also, in these types of situations, it's best to turn on logging to
see the actual SQL being sent - that usually leads to an Aha moment.
Jeff Butler
On Wed, May 5, 2010 at 3:50 AM, Jeremy Jardin <je...@gmail.com> wrote:
>
> Today, I'm having other kind of pb...
> My select request return too much rows..
> I'm still lauching the same test.. and, in debug mode, i've seen something
> wrong here :
>
> protected void addCriterionForJDBCDate(String condition, Date value,
> String property) {
> addCriterion(condition, new java.sql.Date(value.getTime()), property);
> }
>
> protected void addCriterion(String condition, Object value, String
> property) {
> if (value == null) {
> throw new RuntimeException("Value for " + property + " cannot be null");
> }
> Map<String, Object> map = new HashMap<String, Object>();
> map.put("condition", condition);
> map.put("value", value);
> criteriaWithSingleValue.add(map);
> }
>
> This is a generated method (abator).
> The Date value I passed in the method, is a new java.util.Date().
>
> And it's converted as : 1970-01-01 ...
>
> why ?
> I guess the value.getTime() is doing something wrong.
>
>
>
>
> Jeremy Jardin wrote:
>>
>> well, sure, I _always_ use java.util.Date..
>> My sqlMap is an abatorGenerated one.. and it's quite big.
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
>> "http://ibatis.apache.org/dtd/sql-map-2.dtd">
>> <sqlMap namespace="TAB_CHIF">
>> <resultMap
>> class="fr.gouv.finances.douane.dnsce.corinthe.metier.ibatis.bean.TabChif"
>> id="ibatorgenerated_BaseResultMap">
>> <!--
>> WARNING - This element is automatically generated by Apache iBATIS
>> ibator, do not modify.
>> This element was generated on Tue May 04 16:23:34 CEST 2010.
>> -->
>> <result column="DAT_CHIF" jdbcType="DATE" property="datChif" />
>> <result column="MOIS_CHIF" jdbcType="CHAR" property="moisChif" />
>> <result column="AN_CHIF" jdbcType="CHAR" property="anChif" />
>> </resultMap>
>> <sql id="ibatorgenerated_Example_Where_Clause">
>> <!--
>> WARNING - This element is automatically generated by Apache iBATIS
>> ibator, do not modify.
>> This element was generated on Tue May 04 16:23:34 CEST 2010.
>> -->
>> <iterate conjunction="or" prepend="where" property="oredCriteria"
>> removeFirstPrepend="iterate">
>> <isEqual compareValue="true" property="oredCriteria[].valid">
>> (
>> <iterate conjunction="and" prepend="and"
>> property="oredCriteria[].criteriaWithoutValue">
>> $oredCriteria[].criteriaWithoutValue[]$
>> </iterate>
>> <iterate conjunction="and" prepend="and"
>> property="oredCriteria[].criteriaWithSingleValue">
>> $oredCriteria[].criteriaWithSingleValue[].condition$
>> #oredCriteria[].criteriaWithSingleValue[].value#
>> </iterate>
>> <iterate conjunction="and" prepend="and"
>> property="oredCriteria[].criteriaWithListValue">
>> $oredCriteria[].criteriaWithListValue[].condition$
>> <iterate close=")" conjunction="," open="("
>> property="oredCriteria[].criteriaWithListValue[].values">
>> #oredCriteria[].criteriaWithListValue[].values[]#
>> </iterate>
>> </iterate>
>> <iterate conjunction="and" prepend="and"
>> property="oredCriteria[].criteriaWithBetweenValue">
>> $oredCriteria[].criteriaWithBetweenValue[].condition$
>> #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
>> #oredCriteria[].criteriaWithBetweenValue[].values[1]#
>> </iterate>
>> )
>> </isEqual>
>> </iterate>
>> </sql>
>> <select id="ibatorgenerated_selectByExample"
>> parameterClass="fr.gouv.finances.douane.dnsce.corinthe.metier.ibatis.bean.TabChifExample"
>> resultMap="ibatorgenerated_BaseResultMap">
>> <!--
>> WARNING - This element is automatically generated by Apache iBATIS
>> ibator, do not modify.
>> This element was generated on Tue May 04 16:23:34 CEST 2010.
>> -->
>> select DAT_CHIF, MOIS_CHIF, AN_CHIF
>> from TAB_CHIF
>> <isParameterPresent>
>> <include refid="TAB_CHIF.ibatorgenerated_Example_Where_Clause" />
>> <isNotNull property="orderByClause">
>> order by $orderByClause$
>> </isNotNull>
>> </isParameterPresent>
>> </select>
>> </sqlMap>
>>
>>
>> nmaves wrote:
>>>
>>> Wel ALWAYS use java.util.Date
>>>
>>> send us your sqlmap
>>>
>>>
>>> On Tue, May 4, 2010 at 10:03 AM, Jeremy Jardin
>>> <je...@gmail.com>wrote:
>>>
>>>>
>>>> Ok, I'm doing something like that.
>>>>
>>>> TabChifExample criteria = new TabChifExample();
>>>> criteria.createCriteria().andDatChifGreaterThan (new java.util.Date() );
>>>> .. etc...
>>>>
>>>> I've seen in the example class that the java.util.Date is casted in
>>>> java.sql.Date..
>>>>
>>>>
>>>>
>>>> Larry Meadors wrote:
>>>> >
>>>> > Hm, odd - I've done this hundreds of times with oracle - just passing
>>>> > a Date object.
>>>> >
>>>> > Send the relevant code.
>>>> >
>>>> > Larry
>>>> >
>>>> >
>>>> > On Tue, May 4, 2010 at 9:11 AM, Jeremy Jardin
>>>> <je...@gmail.com>
>>>> > wrote:
>>>> >>
>>>> >> Hi,
>>>> >>
>>>> >> I'm simply trying to build a request with Date comparaisons.. and
>>>> ibatis
>>>> >> still reply me empty list..
>>>> >>
>>>> >> My generated request in logs :
>>>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>>>> {conn-100000}
>>>> >> Connection
>>>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>>>> {conn-100000}
>>>> >> Preparing Statement: select * from TAB_CHIF where
>>>> (DAT_CHIF
>>>> >>>?)order by DAT_CHIF
>>>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>>>> {pstm-100001}
>>>> >> Executing Statement: select * from TAB_CHIF where
>>>> (DAT_CHIF
>>>> >>>?)order by DAT_CHIF
>>>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>>>> {pstm-100001}
>>>> >> Parameters: [2010-05-04]
>>>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>>>> {pstm-100001}
>>>> >> Types: [java.sql.Date]
>>>> >>
>>>> >> If I launch handly the same request (with a date parsing) in my
>>>> oracle
>>>> >> client, there's one row.
>>>> >> select * from TAB_CHIF where(DAT_CHIF > to_date('2010-05-04',
>>>> >> 'yyyy-MM-dd'));
>>>> >>
>>>> >>
>>>> >> I guess I've got a dateFormat matter.. but what's the workaround ?
>>>> >>
>>>> >> Thanks.
>>>> >> Jeremy
>>>> >> --
>>>> >> View this message in context:
>>>> >>
>>>> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28447759.html
>>>> >> Sent from the iBATIS - User - Java mailing list archive at
>>>> Nabble.com.
>>>> >>
>>>> >>
>>>> >> ---------------------------------------------------------------------
>>>> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>> >>
>>>> >>
>>>> >
>>>> > ---------------------------------------------------------------------
>>>> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>> >
>>>> >
>>>> >
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28449474.html
>>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>>
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28458279.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: date in where clause does not work.
Posted by Jeremy Jardin <je...@gmail.com>.
Today, I'm having other kind of pb...
My select request return too much rows..
I'm still lauching the same test.. and, in debug mode, i've seen something
wrong here :
protected void addCriterionForJDBCDate(String condition, Date value,
String property) {
addCriterion(condition, new java.sql.Date(value.getTime()), property);
}
protected void addCriterion(String condition, Object value, String
property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("condition", condition);
map.put("value", value);
criteriaWithSingleValue.add(map);
}
This is a generated method (abator).
The Date value I passed in the method, is a new java.util.Date().
And it's converted as : 1970-01-01 ...
why ?
I guess the value.getTime() is doing something wrong.
Jeremy Jardin wrote:
>
> well, sure, I _always_ use java.util.Date..
> My sqlMap is an abatorGenerated one.. and it's quite big.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
> "http://ibatis.apache.org/dtd/sql-map-2.dtd">
> <sqlMap namespace="TAB_CHIF">
> <resultMap
> class="fr.gouv.finances.douane.dnsce.corinthe.metier.ibatis.bean.TabChif"
> id="ibatorgenerated_BaseResultMap">
> <!--
> WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
> This element was generated on Tue May 04 16:23:34 CEST 2010.
> -->
> <result column="DAT_CHIF" jdbcType="DATE" property="datChif" />
> <result column="MOIS_CHIF" jdbcType="CHAR" property="moisChif" />
> <result column="AN_CHIF" jdbcType="CHAR" property="anChif" />
> </resultMap>
> <sql id="ibatorgenerated_Example_Where_Clause">
> <!--
> WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
> This element was generated on Tue May 04 16:23:34 CEST 2010.
> -->
> <iterate conjunction="or" prepend="where" property="oredCriteria"
> removeFirstPrepend="iterate">
> <isEqual compareValue="true" property="oredCriteria[].valid">
> (
> <iterate conjunction="and" prepend="and"
> property="oredCriteria[].criteriaWithoutValue">
> $oredCriteria[].criteriaWithoutValue[]$
> </iterate>
> <iterate conjunction="and" prepend="and"
> property="oredCriteria[].criteriaWithSingleValue">
> $oredCriteria[].criteriaWithSingleValue[].condition$
> #oredCriteria[].criteriaWithSingleValue[].value#
> </iterate>
> <iterate conjunction="and" prepend="and"
> property="oredCriteria[].criteriaWithListValue">
> $oredCriteria[].criteriaWithListValue[].condition$
> <iterate close=")" conjunction="," open="("
> property="oredCriteria[].criteriaWithListValue[].values">
> #oredCriteria[].criteriaWithListValue[].values[]#
> </iterate>
> </iterate>
> <iterate conjunction="and" prepend="and"
> property="oredCriteria[].criteriaWithBetweenValue">
> $oredCriteria[].criteriaWithBetweenValue[].condition$
> #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
> #oredCriteria[].criteriaWithBetweenValue[].values[1]#
> </iterate>
> )
> </isEqual>
> </iterate>
> </sql>
> <select id="ibatorgenerated_selectByExample"
> parameterClass="fr.gouv.finances.douane.dnsce.corinthe.metier.ibatis.bean.TabChifExample"
> resultMap="ibatorgenerated_BaseResultMap">
> <!--
> WARNING - This element is automatically generated by Apache iBATIS
> ibator, do not modify.
> This element was generated on Tue May 04 16:23:34 CEST 2010.
> -->
> select DAT_CHIF, MOIS_CHIF, AN_CHIF
> from TAB_CHIF
> <isParameterPresent>
> <include refid="TAB_CHIF.ibatorgenerated_Example_Where_Clause" />
> <isNotNull property="orderByClause">
> order by $orderByClause$
> </isNotNull>
> </isParameterPresent>
> </select>
> </sqlMap>
>
>
> nmaves wrote:
>>
>> Wel ALWAYS use java.util.Date
>>
>> send us your sqlmap
>>
>>
>> On Tue, May 4, 2010 at 10:03 AM, Jeremy Jardin
>> <je...@gmail.com>wrote:
>>
>>>
>>> Ok, I'm doing something like that.
>>>
>>> TabChifExample criteria = new TabChifExample();
>>> criteria.createCriteria().andDatChifGreaterThan (new java.util.Date() );
>>> .. etc...
>>>
>>> I've seen in the example class that the java.util.Date is casted in
>>> java.sql.Date..
>>>
>>>
>>>
>>> Larry Meadors wrote:
>>> >
>>> > Hm, odd - I've done this hundreds of times with oracle - just passing
>>> > a Date object.
>>> >
>>> > Send the relevant code.
>>> >
>>> > Larry
>>> >
>>> >
>>> > On Tue, May 4, 2010 at 9:11 AM, Jeremy Jardin
>>> <je...@gmail.com>
>>> > wrote:
>>> >>
>>> >> Hi,
>>> >>
>>> >> I'm simply trying to build a request with Date comparaisons.. and
>>> ibatis
>>> >> still reply me empty list..
>>> >>
>>> >> My generated request in logs :
>>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>>> {conn-100000}
>>> >> Connection
>>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>>> {conn-100000}
>>> >> Preparing Statement: select * from TAB_CHIF where
>>> (DAT_CHIF
>>> >>>?)order by DAT_CHIF
>>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>>> {pstm-100001}
>>> >> Executing Statement: select * from TAB_CHIF where
>>> (DAT_CHIF
>>> >>>?)order by DAT_CHIF
>>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>>> {pstm-100001}
>>> >> Parameters: [2010-05-04]
>>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>>> {pstm-100001}
>>> >> Types: [java.sql.Date]
>>> >>
>>> >> If I launch handly the same request (with a date parsing) in my
>>> oracle
>>> >> client, there's one row.
>>> >> select * from TAB_CHIF where(DAT_CHIF > to_date('2010-05-04',
>>> >> 'yyyy-MM-dd'));
>>> >>
>>> >>
>>> >> I guess I've got a dateFormat matter.. but what's the workaround ?
>>> >>
>>> >> Thanks.
>>> >> Jeremy
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28447759.html
>>> >> Sent from the iBATIS - User - Java mailing list archive at
>>> Nabble.com.
>>> >>
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>> >>
>>> >>
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>>> >
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28449474.html
>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>>
>>
>>
>
>
--
View this message in context: http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28458279.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: date in where clause does not work.
Posted by Jeremy Jardin <je...@gmail.com>.
well, sure, I _always_ use java.util.Date..
My sqlMap is an abatorGenerated one.. and it's quite big.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="TAB_CHIF">
<resultMap
class="fr.gouv.finances.douane.dnsce.corinthe.metier.ibatis.bean.TabChif"
id="ibatorgenerated_BaseResultMap">
<!--
WARNING - This element is automatically generated by Apache iBATIS
ibator, do not modify.
This element was generated on Tue May 04 16:23:34 CEST 2010.
-->
<result column="DAT_CHIF" jdbcType="DATE" property="datChif" />
<result column="MOIS_CHIF" jdbcType="CHAR" property="moisChif" />
<result column="AN_CHIF" jdbcType="CHAR" property="anChif" />
</resultMap>
<sql id="ibatorgenerated_Example_Where_Clause">
<!--
WARNING - This element is automatically generated by Apache iBATIS
ibator, do not modify.
This element was generated on Tue May 04 16:23:34 CEST 2010.
-->
<iterate conjunction="or" prepend="where" property="oredCriteria"
removeFirstPrepend="iterate">
<isEqual compareValue="true" property="oredCriteria[].valid">
(
<iterate conjunction="and" prepend="and"
property="oredCriteria[].criteriaWithoutValue">
$oredCriteria[].criteriaWithoutValue[]$
</iterate>
<iterate conjunction="and" prepend="and"
property="oredCriteria[].criteriaWithSingleValue">
$oredCriteria[].criteriaWithSingleValue[].condition$
#oredCriteria[].criteriaWithSingleValue[].value#
</iterate>
<iterate conjunction="and" prepend="and"
property="oredCriteria[].criteriaWithListValue">
$oredCriteria[].criteriaWithListValue[].condition$
<iterate close=")" conjunction="," open="("
property="oredCriteria[].criteriaWithListValue[].values">
#oredCriteria[].criteriaWithListValue[].values[]#
</iterate>
</iterate>
<iterate conjunction="and" prepend="and"
property="oredCriteria[].criteriaWithBetweenValue">
$oredCriteria[].criteriaWithBetweenValue[].condition$
#oredCriteria[].criteriaWithBetweenValue[].values[0]# and
#oredCriteria[].criteriaWithBetweenValue[].values[1]#
</iterate>
)
</isEqual>
</iterate>
</sql>
<select id="ibatorgenerated_selectByExample"
parameterClass="fr.gouv.finances.douane.dnsce.corinthe.metier.ibatis.bean.TabChifExample"
resultMap="ibatorgenerated_BaseResultMap">
<!--
WARNING - This element is automatically generated by Apache iBATIS
ibator, do not modify.
This element was generated on Tue May 04 16:23:34 CEST 2010.
-->
select DAT_CHIF, MOIS_CHIF, AN_CHIF
from TAB_CHIF
<isParameterPresent>
<include refid="TAB_CHIF.ibatorgenerated_Example_Where_Clause" />
<isNotNull property="orderByClause">
order by $orderByClause$
</isNotNull>
</isParameterPresent>
</select>
</sqlMap>
nmaves wrote:
>
> Wel ALWAYS use java.util.Date
>
> send us your sqlmap
>
>
> On Tue, May 4, 2010 at 10:03 AM, Jeremy Jardin
> <je...@gmail.com>wrote:
>
>>
>> Ok, I'm doing something like that.
>>
>> TabChifExample criteria = new TabChifExample();
>> criteria.createCriteria().andDatChifGreaterThan (new java.util.Date() );
>> .. etc...
>>
>> I've seen in the example class that the java.util.Date is casted in
>> java.sql.Date..
>>
>>
>>
>> Larry Meadors wrote:
>> >
>> > Hm, odd - I've done this hundreds of times with oracle - just passing
>> > a Date object.
>> >
>> > Send the relevant code.
>> >
>> > Larry
>> >
>> >
>> > On Tue, May 4, 2010 at 9:11 AM, Jeremy Jardin <je...@gmail.com>
>> > wrote:
>> >>
>> >> Hi,
>> >>
>> >> I'm simply trying to build a request with Date comparaisons.. and
>> ibatis
>> >> still reply me empty list..
>> >>
>> >> My generated request in logs :
>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>> {conn-100000}
>> >> Connection
>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>> {conn-100000}
>> >> Preparing Statement: select * from TAB_CHIF where (DAT_CHIF
>> >>>?)order by DAT_CHIF
>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>> {pstm-100001}
>> >> Executing Statement: select * from TAB_CHIF where (DAT_CHIF
>> >>>?)order by DAT_CHIF
>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>> {pstm-100001}
>> >> Parameters: [2010-05-04]
>> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) -
>> {pstm-100001}
>> >> Types: [java.sql.Date]
>> >>
>> >> If I launch handly the same request (with a date parsing) in my oracle
>> >> client, there's one row.
>> >> select * from TAB_CHIF where(DAT_CHIF > to_date('2010-05-04',
>> >> 'yyyy-MM-dd'));
>> >>
>> >>
>> >> I guess I've got a dateFormat matter.. but what's the workaround ?
>> >>
>> >> Thanks.
>> >> Jeremy
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28447759.html
>> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> > For additional commands, e-mail: user-java-help@ibatis.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28449474.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
>
>
--
View this message in context: http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28457681.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: date in where clause does not work.
Posted by Nathan Maves <na...@gmail.com>.
Wel ALWAYS use java.util.Date
send us your sqlmap
On Tue, May 4, 2010 at 10:03 AM, Jeremy Jardin <je...@gmail.com>wrote:
>
> Ok, I'm doing something like that.
>
> TabChifExample criteria = new TabChifExample();
> criteria.createCriteria().andDatChifGreaterThan (new java.util.Date() );
> .. etc...
>
> I've seen in the example class that the java.util.Date is casted in
> java.sql.Date..
>
>
>
> Larry Meadors wrote:
> >
> > Hm, odd - I've done this hundreds of times with oracle - just passing
> > a Date object.
> >
> > Send the relevant code.
> >
> > Larry
> >
> >
> > On Tue, May 4, 2010 at 9:11 AM, Jeremy Jardin <je...@gmail.com>
> > wrote:
> >>
> >> Hi,
> >>
> >> I'm simply trying to build a request with Date comparaisons.. and ibatis
> >> still reply me empty list..
> >>
> >> My generated request in logs :
> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {conn-100000}
> >> Connection
> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {conn-100000}
> >> Preparing Statement: select * from TAB_CHIF where (DAT_CHIF
> >>>?)order by DAT_CHIF
> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
> >> Executing Statement: select * from TAB_CHIF where (DAT_CHIF
> >>>?)order by DAT_CHIF
> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
> >> Parameters: [2010-05-04]
> >> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
> >> Types: [java.sql.Date]
> >>
> >> If I launch handly the same request (with a date parsing) in my oracle
> >> client, there's one row.
> >> select * from TAB_CHIF where(DAT_CHIF > to_date('2010-05-04',
> >> 'yyyy-MM-dd'));
> >>
> >>
> >> I guess I've got a dateFormat matter.. but what's the workaround ?
> >>
> >> Thanks.
> >> Jeremy
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28447759.html
> >> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> >> For additional commands, e-mail: user-java-help@ibatis.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> > For additional commands, e-mail: user-java-help@ibatis.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28449474.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
Re: date in where clause does not work.
Posted by Jeremy Jardin <je...@gmail.com>.
Ok, I'm doing something like that.
TabChifExample criteria = new TabChifExample();
criteria.createCriteria().andDatChifGreaterThan (new java.util.Date() );
.. etc...
I've seen in the example class that the java.util.Date is casted in
java.sql.Date..
Larry Meadors wrote:
>
> Hm, odd - I've done this hundreds of times with oracle - just passing
> a Date object.
>
> Send the relevant code.
>
> Larry
>
>
> On Tue, May 4, 2010 at 9:11 AM, Jeremy Jardin <je...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> I'm simply trying to build a request with Date comparaisons.. and ibatis
>> still reply me empty list..
>>
>> My generated request in logs :
>> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {conn-100000}
>> Connection
>> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {conn-100000}
>> Preparing Statement: select * from TAB_CHIF where (DAT_CHIF
>>>?)order by DAT_CHIF
>> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
>> Executing Statement: select * from TAB_CHIF where (DAT_CHIF
>>>?)order by DAT_CHIF
>> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
>> Parameters: [2010-05-04]
>> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
>> Types: [java.sql.Date]
>>
>> If I launch handly the same request (with a date parsing) in my oracle
>> client, there's one row.
>> select * from TAB_CHIF where(DAT_CHIF > to_date('2010-05-04',
>> 'yyyy-MM-dd'));
>>
>>
>> I guess I've got a dateFormat matter.. but what's the workaround ?
>>
>> Thanks.
>> Jeremy
>> --
>> View this message in context:
>> http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28447759.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
>
--
View this message in context: http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28449474.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: date in where clause does not work.
Posted by Larry Meadors <la...@gmail.com>.
Hm, odd - I've done this hundreds of times with oracle - just passing
a Date object.
Send the relevant code.
Larry
On Tue, May 4, 2010 at 9:11 AM, Jeremy Jardin <je...@gmail.com> wrote:
>
> Hi,
>
> I'm simply trying to build a request with Date comparaisons.. and ibatis
> still reply me empty list..
>
> My generated request in logs :
> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {conn-100000}
> Connection
> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {conn-100000}
> Preparing Statement: select * from TAB_CHIF where (DAT_CHIF
>>?)order by DAT_CHIF
> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
> Executing Statement: select * from TAB_CHIF where (DAT_CHIF
>>?)order by DAT_CHIF
> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
> Parameters: [2010-05-04]
> DEBUG - [] - [main] (JakartaCommonsLoggingImpl.java:27) - {pstm-100001}
> Types: [java.sql.Date]
>
> If I launch handly the same request (with a date parsing) in my oracle
> client, there's one row.
> select * from TAB_CHIF where(DAT_CHIF > to_date('2010-05-04',
> 'yyyy-MM-dd'));
>
>
> I guess I've got a dateFormat matter.. but what's the workaround ?
>
> Thanks.
> Jeremy
> --
> View this message in context: http://old.nabble.com/date-in-where-clause-does-not-work.-tp28447759p28447759.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org