Working with Oracle Objects
Hi,
I'm working on an application which has the following configuration
JBoss 4 server
Spring 2
Hibernate 3.2.4.GA
Oracle 10g database (10.2.0.2.0)
JDK 1.5
I want to invoke a procedure that takes in an array of Oracle objects. To do this I need to create instances of the following objects
oracle.sql.StructDescriptor
oracle.sql.STRUCT
oracle.sql.ArrayDescriptor
oracle.sql.Array
I am trying to create the StructDescriptor object using the connection obtained from hibernate (session.connection() method) but getting a ClassCastException as the call to create a StructDescriptor object seems to be type casting the connection to oracle.jdbc.OracleConnection
Specifically I have the following line in my code which creates an instance of oracle.sql.StructDescriptor class as follows
StructDescriptor.createDescriptor("someSqlObject", session.connection());
Where session is my org.hibernate.Session object.
So I have 2 questions:
1. Why can't we cast connection retrieved from session.connection() method to oracle.jdbc.OracleConnection ? Is there a work around to the ClassCastException error ?
2. Why is the session.connection() method deprecated ? Is there any alternative that we can use ?
I'm not sure if this is a problem with hibernate or it's because Spring is giving me a RunTime proxy connection object when I ask for it.
I end up getting the following error
java.lang.ClassCastException: $Proxy35
Thanks in advance.