Re: Please suggest proper setup/usage for Oracle CHAR(1) (Boolean), NUMBER, and VARCHAR2

From: jah.volcano (jah.volcan..mail.com)
Date: Tue Dec 13 2005 - 19:24:40 EST

  • Next message: Andrus Adamchik: "Re: Joint PreFetch on table with a clob column"

    Andrus,

    Thanks! That does help. I implemented a new table and its objects to
    test out BOOLEAN, VARCHAR, and INTEGER and it worked great on Oracle.

    My previous existing table is choking on dates/timestamps I believe. It
    did work for MySQL just prior, but moving to Oracle has become an
    issue. I am getting a 'java.sql.SQLException: Invalid column type' now
    when I attempt to insert into this table. I took the debug line from
    Cay and attempted to manually insert it into Oracle. It didn't like the
    date formats and the BOOLEAN 'true' string, but everything else worked
    in the statement. The date info getting inserted looked identical in
    format to the insert statement from my working table. I attempted to
    hookup IronEyeSQL to see if there is something strange being sent to
    Oracle, but could not get it to work with Cay. I have spent way too
    long troubleshooting this one and don't have much left. Any thoughts?

    Thanks,
    Joseph

    Andrus Adamchik wrote:

    > The easiest way to determine what native DB type can be mapped to a
    > given JDBC type is to check types.xml file located in cayenne.jar and
    > cayenne sources folder in each DB adapter package. In our case
    > checking org/objectstyle/cayenne/dba/oracle/types.xml BOOLEAN works
    > with Oracle INTEGER. Conversion between objects and Oracle is fully
    > automatic.
    >
    > Alternatively, in case you want to use something non-standard, you
    > can implement an ExtendedType to do an arbitrary conversions of values:
    >
    > http://objectstyle.org/cayenne/userguide/access-stack/extended-
    > types.html
    >
    > Andrus
    >
    >
    > On Dec 13, 2005, at 7:11 PM, jah.volcano wrote:
    >
    >> I would like to know the reccomended way to set up Cayenne (cay)
    >> mapping datatypes for Oracle. I pose some possible types below and
    >> would like to know if they are a good idea or not. Is there any
    >> documentation on this? I did not see any that would help me.
    >>
    >> I am using cay 1.2M8 and have had difficulty with the boolean type
    >> in MySQL and assume the same will apply in Oracle. When cay reads a
    >> DB value of 't', 'f', or null, the response seems to always be
    >> null. In MySQL, I switched the type to BOOL and then 'true' 'false'
    >> started showing in the DB and cay was happy. Oracle doesn't have a
    >> BOOL, I think they do have Boolean only accesible with PL/SQL, which
    >> does not interest me. I will try the CHAR(1) in Oracle to see what
    >> happens. Do you have a suggestion on this? What is a good way to
    >> work with booleans in cay? Do I need to convert a 't' or 'f' myself
    >> into a Boolean or will cay do this for me?
    >>
    >> Oracle Cayenne
    >> NUMBER NUMERIC
    >> CHAR(1) BOOLEAN
    >> VARCHAR2 VARCHAR
    >>
    >> Thanks,
    >> Joseph
    >>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Dec 13 2005 - 19:24:41 EST