I think there's something wrong with the way OJB is turning an addLessThan to SQL code on the mySQL implementation. I switched my code to SimpleDateFormat the submitted dates and turn them into mySQL-DateTime format (2003-05-18 00:00:00). I then use addSQL("StartDate <= '" + strStartDate + "' AND StartDate < '" + strEndDate + "'");
This works just fine... I guess I can deal with it for now.
Edson Carlos Ericksson Richter wrote:
Nop. I'm using SapDB and MS SQL. Maybe you are having some kind of driver issue here.
Edson Richter
----- Original Message ----- From: "Aaron Longwell" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Monday, June 16, 2003 10:40 AM
Subject: Re: addLessThan or addBetween with Dates in mySQL
Edison,
I'm actually using the same conversion... were you using mySQL?
Thanks, Aaron
Edson Carlos Ericksson Richter wrote:
Hi!t
I've used Dates normally with less than, greater than and between with SapDB. Unique thing I had todo is put a "conversion" in field like:
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimes
ampFieldConversion"
then it works for me.
Edson Richter
----- Original Message ----- From: "Aaron Longwell" <[EMAIL PROTECTED]>
To: "OJB User" <[EMAIL PROTECTED]>
Sent: Monday, June 16, 2003 2:42 AM
Subject: addLessThan or addBetween with Dates in mySQL
OJB Experts,
I am using mySQL with OJB to build an event calendar. I need to display 1 month's worth of events. At first, I tried code like this:
criteria.addBetween("EventDate", startDate, endDate);
where startDate and endDate are java.util.Dates. I got no results, even though there are events in the database between those two dates. I retried with a single addGreaterOrEqualThan(). This worked as expected, returning events whose date was on or after the startDate submitted. I then tried the addLessOrEqualThan(). This returned 0 results, even though there are events before the submitted date in the database.
The Javadocs show examples of these commands being used with integers and not dates. Am I wrong to even attempt this? I would prefer not to implement my method an addSQL() call. I would think Date-handling would be automatic with an OJB tool.
Thanks for the help, Aaron
--------------------------------------------------------------------- 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.489 / Virus Database: 288 - Release Date: 10/6/2003
--------------------------------------------------------------------- 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]
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.489 / Virus Database: 288 - Release Date: 10/6/2003
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
