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]

Reply via email to