Bugs item #538236, was opened at 2002-04-02 19:44
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=538236&group_id=22866
Category: JBossCMP
Group: v3.0 Rabbit Hole
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Stephen Coy (scoy)
Assigned to: Dain Sundstrom (dsundstrom)
Summary: Oracle data mappings use TIMESTAMP type
Initial Comment:
The standardjbosscmp-jdbc.xml tries to use the
TIMESTAMP datatype for mapping java.util.Date to
an sql type for both Oracle7 and Oracle8
databases:
<mapping>
<java-type>java.util.Date</java-type>
<jdbc-type>TIMESTAMP</jdbc-type>
<sql-type>TIMESTAMP</sql-type>
</mapping>
TIMESTAMP is not a valid Oracle7/8 datatype.
Unfortunately there does not seem to be any kind
of equivelent that we can use here. Oracle DATE
types only have a granularity of whole seconds.
I will investigate whether or not we can get away
with using a NUMBER type here.
----------------------------------------------------------------------
>Comment By: Stephen Coy (scoy)
Date: 2002-04-15 11:12
Message:
Logged In: YES
user_id=463096
Did you happen to fix the standardjaws.xml file as well?
It looks like many of the tests are still CMP 1.1, and so
use this instead.
In fact, some kind person fixed dbtest so that it now
(almost) works with Oracle. It indeed does work with
the correct mappings in standardjaws.xml.
For jaws, I found that the following two mappings:
<mapping>
<java-type>java.lang.Byte</java-type>
<jdbc-type>NUMERIC</jdbc-type>
<sql-type>NUMBER(3)</sql-type>
</mapping>
<mapping>
<java-type>java.lang.Short</java-type>
<jdbc-type>NUMERIC</jdbc-type>
<sql-type>NUMBER(5)</sql-type>
</mapping>
must have a JDBC type of NUMERIC. Currently,
java.lang.Byte is set to SMALLINT in
standardjbosscmp-jdbc.xml.
The JAWs implementation appears to use setObject to
set many parameter values
(org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setP
arameter) which causes ClassCastExceptions in the
Oracle JDBC driver when passed comp.lang.Byte/Short
objects. It possibly needs to switch on jdbcType and
call setByte/setShort, etc instead. I spent some time
digging thru the CMP2 implementation but never got to
the bottom of whether it too is using setObject or the
more explicit setByte/setShort calls.
What all this means is that:
a) for the current old jaws implementation, these two
mappings must have JDBC types of NUMERIC for
Oracle;
b) if the new CMP2 is using setObject (on the
PreparedStatement), then (a) applies as well. On the
other hand, if it is explicitly calling setByte, etc then we
should be able to set these JDBC types to TINYINT and
SMALLINT respectively.
Additionally, I think that we need a CMP2 version of
dbtest, or at least the AllTypesBean code. I can look at
doing this if you want.
----------------------------------------------------------------------
Comment By: Dain Sundstrom (dsundstrom)
Date: 2002-04-15 01:54
Message:
Logged In: YES
user_id=251431
I committed the Oracle9i mapping.
I changed the name of the mapping to Oracle9i, and fixed
the Oracle7 mapping to not use TIMESTAMP.
----------------------------------------------------------------------
Comment By: Stephen Coy (scoy)
Date: 2002-04-14 14:45
Message:
Logged In: YES
user_id=463096
Here's a pass at the data mappings for Oracle 8/9.
----------------------------------------------------------------------
Comment By: Stephen Coy (scoy)
Date: 2002-04-10 11:51
Message:
Logged In: YES
user_id=463096
It looks like we have to map TIMESTAMP to SQL DATE
for Oracle 7&8. We should put a comment in the file
remarking upon the loss of granularity - and that the
user must either store milliseconds as a long (see
java.util.Date.getTime()) or use Oracle 9 if this
behaviour is needed.
In the meantime, I think I've located a version of
Oracle9i, so I will see what I can do for a data mapping.
----------------------------------------------------------------------
Comment By: Stephen Coy (scoy)
Date: 2002-04-10 10:33
Message:
Logged In: YES
user_id=463096
We need a new set of mappings for Oracle9 (which is
basically their big move to Java in general).
Unfortunately, I don't yet have access to this, so it's not
practical for me to do it.
I *will* however, get to the bottom of whether or not we
can use a NUMBER type for this purpose in Oracle7/8.
----------------------------------------------------------------------
Comment By: Dain Sundstrom (dsundstrom)
Date: 2002-04-10 02:32
Message:
Logged In: YES
user_id=251431
What is the answer? Should we make a new mapping for
Oracle 9i? Is either of you willing to create a new
mapping for 9i (based on the 8 mapping)?
----------------------------------------------------------------------
Comment By: Markus Kling (mkling)
Date: 2002-04-07 02:30
Message:
Logged In: YES
user_id=360804
Up to version 8.1.7, Oracle supports only one temporal
datatype: DATE, which has a granularity of second.
The following datatypes are new for Oracle9i:
TIMESTAMP TIMESTAMP [ (fractional_seconds_precision)]
TIMESTAMP WITH [LOCAL]TIME ZONE
INTERVAL YEAR TO MONTH
INTERVAL DAY TO SECOND
fractional_seconds_precision optionally specifies the
number of digits in the fractional part of the SECOND
datetime field and can be a number in the range 0 to 9. The
default is 6.
Below 9i date columns can be written and read as
java.sql.Timestamp - the ms just get truncated.
-Markus
----------------------------------------------------------------------
Comment By: Peter Levart (plevart)
Date: 2002-04-07 02:10
Message:
Logged In: YES
user_id=346981
Are you sure? It works for me. It might be that this is a
new feature of Oracle 9i (I haven't tried with Oracle 7 or
8).
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=538236&group_id=22866
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development