Thanks, turns out this was a case sensitivety issue inside my daos. :(
On Mon, 14 Mar 2005 07:05:45 -0000, Charles Anthony <[EMAIL PROTECTED]> wrote: > Hi, > > OJB uses prepared statements to generate queries - e.g. > > SELECT blah FROM foo WHERE datecreated >= ? > > It then uses the JDBC driver to bind the values to the query > PreparedStatement#setObject(ix, value, targetSqlType) > > http://java.sun.com/j2se/1.4.2/docs/api/java/sql/PreparedStatement.html#setO > bject(int,%20java.lang.Object,%20int) > > For the targetSqlType, OJB uses the definition in the repository. > > In short, OJB does not put values direcly into the SQL issued to the > database. > > So - what's going on ? > > I would be looking in these areas : > > a) does the SQL type in the repository match the datatype of the column in > the database ? If there is a mismatch, this could cause the JDBC driver to > do some kind of bizarre conversion... > > b) MySQL jdbc drivers - are you using the latest versions ? Is there a bug > in the drivers to do with DATETIME columns ? > > If there is a specific issue with MySQL and a certain SQL Type, we can deal > with it in the PlatformMySQLImpl class in OJB - by the looks of it, we > already BLOB/CLOBS/BIT types in a special way. > > I should add that I am not an OJB developer, merely a long-standing user, > and I am even less of a MySQL user (I installed it once, got 70% of our App > to work and decided to leave it until someone paid us to do the rest) - and, > moreover, am up to my neck in passed deadlines and so can't offer much more > practical help. > > Hope that helps a little, > > Cheers, > > Charles. > > -----Original Message----- > From: Jamo Smith [mailto:[EMAIL PROTECTED] > Sent: 14 March 2005 02:02 > To: OJB Users List > Subject: Re: MySQL OJB and Date Objects > > This is still a huge problem. Under no setup can I get OJB to > generate a WHERE clause with a date format other than the default > Date.toString(). > > How do I control the way OJB generates WHERE clauses? > > On Wed, 9 Mar 2005 11:36:23 -0600, Turcotte Eric D Contr 805 CSPTS/SCE > <[EMAIL PROTECTED]> wrote: > > I had issues with this as well. You want to use TIMESTAMP as the > > jdbc-type and use the JavaDate2SqlTimestampFieldConversion. > > > > /** > > * @ojb.field column="DATECREATED" > > * jdbc-type="TIMESTAMP" > > * > > conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTi > > mestampFieldConversion" > > */ > > > > This introduces a problem with MySQL because the TIMESTAMP column type > > updates the record to the current date/time when the record is inserted > > or updated. If you want OJB to set the date/time in that column, the > > MySQL column type to use is DATETIME. If you are using Torque to > > generate your SQL scripts, it will try to use TIMESTAMP as the column > > type so I had to write the following workaround for Maven: > > > > <postGoal name="torque:sql"> > > > > <ant:replace file="${torque.sql.dir}/${torque.project}-schema.sql" > > token="TIMESTAMP" value="DATETIME"/> > > > > </postGoal> > > > > This seems like a bug. > > > > > I can't seem to find any documentation on this. > > > > > > I have a date object: java.util.Date > > > /** > > > * @ojb.field column="DATECREATED" > > > * jdbc-type="DATE" > > > * > > conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlDa > > teFieldConversion" > > > */ > > > private Date date; > > > > > > I have tried conversion: > > > *.JavaDate2SqlTimeStampField > > > > > > & I have tried no conversion. > > > > > > No matter what OJB generates queries like this: > > >...... WHERE datecreated >= 'Mon Mar 08 20:53:11 CST 2004' .......... > > > > > > This doesn't work since MySQL requires dates to be YYYY-MM-DD hh:mm:ss > > > for comparison. > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- > Jamo Smith > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > ___________________________________________________________ > HPD Software Ltd. - Helping Business Finance Business > Email terms and conditions: www.hpdsoftware.com/disclaimer > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Jamo Smith --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
