Is it possible that the problem is with the JDBC adapter version? I
googled Oracle Date and found this brain-numbing essay on Oracle-JDBC-
DATE-Date-Timestamp and the the version complications as well.
http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.html#08_01
(I am even more impressed with the Cayenne team after reading this FAQ.)
Given that I have only a small clue as to what your error message
means, I would recommend that you start by verifying the versions of
your Oracle component configuration against this FAQ from Oracle. If
your versions are in fact the ones you anticipate (and are not the
cause of the Date/Timestamp controversy), only then I would go back to
concentrating on the cayenne configuration.
HTH,
Joe
On Jan 28, 2009, at 12:31 PM, Alessio Giovanni Baroni wrote:
Nothing, returns an exception ("getTimestamp is not valid for
getT4CNumber
.....").
If I use "TO_CHAR", there is another problem, because when I do
get(...)
from DataObject, Cayenne execute
a query, not equal as the query in ctxt.performQuery(Bar.class,
"SELEC........"); Cayenne not save the TO_CHAR!
Help?
Thanks.
2009/1/28 Andrus Adamchik <and...@objectstyle.org>
java.sql.Timestamp extends java.util.Date, so it is ok.
(and in any event doublecheck that the column in a table for the
Bar entity
is mapped as TIMESTAMP).
Andrus
On Jan 28, 2009, at 5:34 PM, Alessio Giovanni Baroni wrote:
But if I have SQLTemplate(Bar.class, .....), and in class Bar I set
the
field Foo as Date, isn't an error cast it to java.lang.Timestamp??
Thanks.
2009/1/28 Andrus Adamchik <and...@objectstyle.org>
My (admittedly novice) solution was to map it via Modeler to a
TIMESTAMP.
This is actually a correct solution. Only if I am not mistaken it
doesn't
work 100% on 2.0.x (IIRC it works for SelectQuery, but not
SQLTemplate).
In
3.0 it should work with SQLTemplate as well.
Andrus
On Jan 28, 2009, at 5:12 PM, Joe Baldwin wrote:
Andrus,
I looked up the Oracle Date definition and it does in fact keep
time
info
in the database. My (admittedly novice) solution was to map it
via
Modeler
to a TIMESTAMP. Does this reveal the same problem with the Oracle
adapter
as mapping it via Modeler-DATE?
Joe
On Jan 28, 2009, at 9:58 AM, Andrus Adamchik wrote:
I guess that's how Oracle driver returns the metadata for the DATE
column
in the ResultSet. The workaround is to use #result() directive
in the
SQL:
http://cayenne.apache.org/doc20/scripting-sqltemplate.html
Hope this helps,
Andrus
On Jan 28, 2009, at 4:48 PM, Alessio Giovanni Baroni wrote:
Hi to all,
I have the following code:
.............
query = new SQLTemplate("SELECT FOO FROM BAR");
results = ctxt.performQuery(Bar.class, query);
for(int i = 0; i < results.size() - 1; ++i)
{
Bar f = (Bar)results.get(i);
...... (f.getFoo());
....................
}
In the Oracle DB the field FOO is a DATE and I map it to
java.util.Date.
When I do .getFoo(), the date that I have is without the
hours/minutes/seconds.
Why? How do I resolve it?
Thanks.