Hello, Ralf.

Thanks for your quick answer, but it does not solve
the problem. I have to say that is my fault, I explined
the problem in a wrong way. What I actually do is what
you suggested, bind the java.util.Date to the query (when
I posted that simple example, I forgot to do so, but in my
real app it is just what I do). Anyway, is does not work either.

Thank again, Ralf.



On Mon, 22 Aug 2005 13:53:15 +0200, Ralf Joachim <[EMAIL PROTECTED]> wrote:

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]
-------------------------------------------------




-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to