For what it's worth, I use java.util.Date for all of my java classes,
and TIMESTAMP(6) (Oracle) for all of my jdbc types in a Cayenne 1.1.4
project. I did have to make a minor patch to the types.xml file, and
the 1.1.4 modeler doesn't generate the right sql so I have to modify
it by hand afterwards from " DATE " to " TIMESTAMP(6) ". This works
for optimistic locking on date fields under Cayenne 1.1.
I can't remember what I've been doing for my 1.2 projects. I suspect
I've been using DATE instead.
Index: types.xml
===================================================================
RCS file:
/cvsroot/cayenne/cayenne/src/cayenne/java/org/objectstyle/cayenne/dba/oracle/Attic/types.xml,v
retrieving revision 1.3
diff -u -r1.3 types.xml
--- types.xml 29 Oct 2003 16:58:07 -0000 1.3
+++ types.xml 25 May 2007 18:41:22 -0000
@@ -64,7 +64,7 @@
<db-type name="DATE"/>
</jdbc-type>
<jdbc-type name="TIMESTAMP">
- <db-type name="DATE"/>
+ <db-type name="TIMESTAMP"/>
</jdbc-type>
<jdbc-type name="TINYINT">
<db-type name="SMALLINT"/>
On 6/19/07, Peter Schröder <[EMAIL PROTECTED]> wrote:
hi kevin,
i think that you can set DATE for the db-entity in the modeler. afaik, this has
impact on the resultset you get. this was something i resently discovered, but
i am not sure about what and why.
kind regards
peter
-----Ursprüngliche Nachricht-----
Von: Kevin Menard [mailto:[EMAIL PROTECTED]
Gesendet: Montag, 18. Juni 2007 21:44
An: [email protected]
Betreff: Converting timestamp to date for queries
Hi,
I've been playing around with django a lot lately and they have a
concept of "generic views", which basically is a way to list objects by
date and/or slug. I decided to try doing this with my Tapestry 4 app,
but have been running into problems. In particular, one of my models
uses TIMESTAMP for its "pubDate" field. Generally, I do want to have
both the date and time information, but I'd like to query by date and
slug. It is assumed that there is a unique combination of both.
Ex.:
http://www.example.com/2007/06/18/some-slug-text
I've been trying to build up a java.util.Date based on the information
provided in that URL and pass it off to a named query. The query
executes just dandy, but I get nothing back because the time values do
not match. Is there anyway to do a type conversion and just compare by
the date portion?
Thanks,
Kevin
Kevin Menard
Servprise International, Inc.
800.832.3823 x308