Thanks for the info; however, it doesn't seem right that you should have to set the NLS_DATE_FORMAT to cooperate with OJB!

Is this a property of the JDBC driver you are using? I don't think I've encountered this before; I'm not an OJB wizard, but I'm pretty sure I've got some date-based queries.

It seems like, in all the abstraction of OJB, there ought to be a place where you could configure this to behave correctly without being forced to change your database settings.

Also, isn't p6spy just logging? I don't think it's correct to say "p6spy always built...".

Just some thoughts from another OJB/Oracle user.

Joe


At 7:13 PM -0700 2/18/04, Brad Matlack wrote:
Hi,

After struggling and searching for a solution to Oracle date comparisons,
I'ld like to share what I came up with.

Using the standard TIMESTAMP descriptor where "date" is a java.util.Date:
<field-descriptor
name="date"
column="audit_date"
jdbc-type="TIMESTAMP"
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimest
ampFieldConversion"
/>

and the criteria:
criteria.addGreaterThan("date", fromJavaUtilDate);
or:
criteria.addGreaterThan("date", fromJavaSqlDate);

p6spy always built this where clause which failed:

A0.audit_date > '2003-01-01 00:00:00.0'

By setting the NSL_DATE_FORMAT in the init.ora to this:

nls_date_format="YYYY-MM-DD HH24:MI:SS"

we have success!

Hope that helps future Oracle developers.
Cheers,
Brad





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining."
-- Jef Raskin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to