I found my problem. In line 287 of StatementManager there's a setObject( Statement, value ) call. It was getting a java.util.Date that hadn't been converted to a java.sql.Date. I added a check to see if the value was an instanceof java.util.Date and to convert it to a java.sql.Date if it is.
--mikej -=------ mike jackson [EMAIL PROTECTED] > -----Original Message----- > From: mike jackson [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 03, 2004 8:37 AM > To: 'OJB Users List' > Subject: oracle and dates > > Datebase: Oracle 8.1.7.4 or Oracle 9.2.0.4 > OJB Version: 1.0rc5 > > I'm having problems trying to do a search something like this: > > select * from foobar where date1 >= sysdate and date1 <= sysdate +1 > > I've tried using the greaterThan and lessThan methods on criteria but I > get > an "invalid column error" from Oracle. I thought that perhaps the > parameters weren't getting bound to the PreparedStatement properly, but I > think I've been able to rule that out. It appears that it's failing in > the > setObject method of the Oracle driver. I've tried to modify the > setObjectForStatement but for some reason it's still using the setObject. > > I then looked at the list archives and found something about using addSql, > so I tried that. That gave me StringOutOfBounds(-2) exceptions, with the > criteria display showing that the I added looked to be added twice with a > "null" at the end of the string (looks like this "<SQL><SQL>null"). So > I've > been looking at the source for the addSql method which seems to create a > SqlCriteria, all of which looks ok to me. My guess is that the SQL > generator is getting confused or something. > > I then tried setting up the criteria for the date ranges as separate > criteria. I added the second criteria to the first as an addAndCriteria, > but instead of having just one of the "<SQL><SQL>null"'s I ended up with > two > of them. > > Anyway what I'm looking for is someone who can give me a clue of another > way > to make this work. Or suggest somewhere in the code that I haven't looked > at yet to fix. I'll happily upload the repository.xml and the code that > calls OJB if need be. > > --mikej > -=------ > mike jackson > [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > 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]
