Don't know if it'll apply in your situation, but make sure you've got
the most recent oracle drivers. In the past, I saw the behavior
change depending on what driver I was using. I also switched all of
my DATE fields to TIMESTAMPs in the end.
On Wed, Jan 28, 2009 at 12:31 PM, Alessio Giovanni
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 a
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_CHA
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
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
> My (admittedly novice) solution was to map it via Modeler to a TIMESTAMP.
>>
>
>
> This is actually a correct solution
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
Didn't realize it doesn't support JDBC type in the #result. I think
you can still force it by specifying "java.sql.Timestamp" as the Java
class:
String sql = "SELECT"
+ " #result('ARTIST_ID' 'int'),"
+ " #result('ARTIST_NAME' 'String'),"
+ " #result('DATE_OF_BIRTH' 'java.sql.Timestam
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, a
"SELECT #result('FOO' 'java.sql.Timestamp') FROM BAR"
On Wed, Jan 28, 2009 at 10:05 AM, Alessio Giovanni Baroni <
alessiogiovanni.bar...@gmail.com> wrote:
> A simple example?
>
> Thanks.
>
>
> 2009/1/28 Andrus Adamchik
>
> > I guess that's how Oracle driver returns the metadata for the DATE col
A simple example?
Thanks.
2009/1/28 Andrus Adamchik
> 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,
>
>
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 wr
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
12 matches
Mail list logo