java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcCallableState
zbJan 26 2006 — edited Feb 1 2006We are using:
Toplink 9.0.4.5 (Build 040930)
Database: Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
Driver: Oracle JDBC driver Version: 9.2.0.7.0
WSAD: version 5.1.2
I have an object RequestVO that has 3 parameters startDateTime and endDateTime and id. In java, id is a primitive long, startDateTime and endDateTime are java.util.Calendar objects. I use then Calendar object since i want to store all time as an offset of GMT. The java.util.Calendar has a timezone of "US/Eastern"
In the database, id is a number field, startDateTime is a
TIMESTAMP WITH TIME ZONE and endDateTime is a TIMESTAMP WITH TIME ZONE.
In Toplink, i have mapped startDateTime as a Conversion Mapping to a java.util.Calendar. i have mapped endDateTime as a Conversion Mapping to a java.util.Calendar.
In sessions.xml, i have set the platform as Oracle9i so i uses Oracle9Platform. I have also set Native SQL to true.
I expected this to properly insert the values into the database with the timezone. I used Toplink connected to the database directly (toplink managed connection) and it worked fine. i was able to insert and select.
I then updated the sessions.xml to map to a database connection managed by WSAD. I do this so i can use their pooling and other support. Now i get this error "Exception data: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcCallableStatement"
It would seem that Toplink is trying to return an OracleCallableStatement and WSAD is wrapping it with something and there is a breakdown in the inheritance tree. I checked and made sure the JDBC is the only driver in the class path. I did have a classes12.zip so i removed it to no avail.
When i upmap the startDateTime and endDateTime in toplink, it works fine but those 2 columns do not get any data since they are unmapped.
Do you have any thoughts on this? is it a problem with the way i set things up? is it a toplink bug? or a wsad bug?
Let me know if you need any more data.
Thanks,
Zev.
---------------------------------
sessions.xml segment:
---------------------------------
<session>
<name>Request</name>
<project-xml>request/CT_Request.xml</project-xml>
<session-type>
<server-session/>
</session-type>
<login>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<datasource>jdbcxa/ctfdeva3</datasource>
<platform-class>oracle.toplink.oraclespecific.Oracle9Platform</platform-class>
<uses-native-sequencing>true</uses-native-sequencing>
<sequence-preallocation-size>1</sequence-preallocation-size>
<should-bind-all-parameters>false</should-bind-all-parameters>
<uses-external-connection-pool>true</uses-external-connection-pool>
<uses-native-sql>true</uses-native-sql>
<uses-external-transaction-controller>true</uses-external-transaction-controller>
</login>
<connection-pool>
<is-read-connection-pool>false</is-read-connection-pool>
<name>default</name>
<max-connections>1</max-connections>
<min-connections>1</min-connections>
<login>
<datasource>DATASOURCE</datasource>
</login>
</connection-pool>
<enable-logging>true</enable-logging>
<logging-options>
<log-debug>true</log-debug>
<log-exceptions>true</log-exceptions>
<log-exception-stacktrace>true</log-exception-stacktrace>
<print-thread>false</print-thread>
<print-session>true</print-session>
<print-connection>true</print-connection>
<print-date>true</print-date>
</logging-options>
</session>
-------------------------------------------
toplink XML segment
-------------------------------------------
<database-mapping>
<attribute-name>startDateTime</attribute-name>
<read-only>false</read-only>
<field-name>REQUEST.START_DATE_TIME</field-name>
<field-classification>java.util.Calendar</field-classification>
<type>oracle.toplink.mappings.TypeConversionMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>endDateTime</attribute-name>
<read-only>false</read-only>
<field-name>REQUEST.END_DATE_TIME</field-name>
<field-classification>java.util.Calendar</field-classification>
<type>oracle.toplink.mappings.TypeConversionMapping</type>
</database-mapping>