Hi Sergio,
you should be able to execute such a query with:
OQLQuery query = db.getOQLQuery(
"select a from MyClass a where a.mydate > $1");
query.bind(expirationDate);
QueryResults results = query.execute();
Regards
Ralf
Sergio Collantes schrieb:
>
> Hi all:
>
> I've been having trouble when trying to
> build an OQL query using java.util.Date types.
> Suppose we have a simple class "MyClass" with
> a java.util.Date filed named "myDate".
>
> The query goes like this:
>
> select a from MyClass a where a.mydate > expirationDate
>
> Let's suppose that the object expirationDate is declared
> in this way:
>
> Calendar calendar = Calendar.getInstance();
> calendar.set (...) // Whe set the expiration date
> java.util.Date expirationDate = calendar.getTime();
>
> The field myDate is a varchar in the database, and the
> mapping is correct (i.e. the data is converted to Date
> correctly in the JDO, i have tried it and it works).
> The mapping is declared as follows:
>
> <field name="mydate" type="date">
> <sql name="mydate" type="char[dd/MM/yyyy]"/>
> </field>
>
> I assume in doing the wrong query, ¿can anybody tell
> me what do I have to do?
>
> -------------------------------------------------
> If you wish to unsubscribe from this list, please send an empty message
> to the following address:
>
> [EMAIL PROTECTED]
> -------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------