You should declare
<field-descriptor name="startDate" column="StartDate"
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest
ampFieldConversion"
jdbc-type="TIMESTAMP"/>
This should make things work (at least, WFM).
Edson Richter
----- Original Message -----
From: "Aaron Longwell" <[EMAIL PROTECTED]>
To: "ObjectRelationalBridge User" <[EMAIL PROTECTED]>
Sent: Tuesday, June 10, 2003 3:28 PM
Subject: Best Practices: Dates
Goal: Retrieve a collection of objects with dates between X and Y
Current Implementation:
Event.java (Business Object) contains:
java.util.Date startDate
repository.xml maps:
<field-descriptor name="startDate" column="StartDate"
jdbc-type="TIMESTAMP"/>
PB Query:
Criteria criteria = new Criteria();
criteria.addBetween("StartDate", startDate, endDate);
Query query = QueryFactory.newQuery(Event.class, criteria);
where startDate and endDate are java.util.Dates.
When this query executes, I receive no errors about converting from
TIMESTAMP to java.util.Date... and I DO receive results..... I receive
ONLY records where the StartDate column is 0000-00-00 00:00:00... or
blank in other words. Why is it matching blank records when I am
attempting to find records between date X and date Y?
I get similar results when using the addGreaterOrEqualThan submitting
startDate. In this case I receive ALL records (including those with
0000-00-00 00:00:00).
If you'd rather ignore all the above... I'd like to see best practices
for using java.util.Dates with OJB (I'm using mySQL DateTime columns).
Thanks,
Aaron Longwell
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.488 / Virus Database: 287 - Release Date: 5/6/2003
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]