hi jamo,
the comparison is done in sql not in java.
jakob
Jamo Smith wrote:
Hey Folks!
I ran into a problem tonight trying to return a list of entries that match a specific date.
For testing purposes I am passing a date object into addEqualTo that I built like this:
Date date = new Date();
date.setTime(
entry.getDate().getTime() (;
the entry is a entry I got by querying for all entries in the database. However when I do a query like this:
Transaction tx = implementation.newTransaction(); tx.begin(); PersistenceBroker broker = ((HasBroker) tx).getBroker(); Criteria criteria = new Criteria(); criteria.addEqualTo("date", date); QueryByCriteria query = new QueryByCriteria(Entry.class, criteria);
return broker.getCollectionByQuery(query);
according to the Date object's javadocs it uses getTime() to compare the two dates. I tested date.equals(entry.getDate()) and it returns true for at least one entry in the database. The collection is sized 0 every time. I can't figure this out for the life of me.
Thanks folks, I appreciate your support. - Jamo
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
