Jun 25th, 2007, 02:33 PM
Working with Oracle Objects
I'm working on an application which has the following configuration
JBoss 4 server
Oracle 10g database (10.2.0.2.0)
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
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
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
Thanks in advance.
Jun 26th, 2007, 02:40 PM
Re: Oracle objects
Managed to solve the first problem by making use of
java.sql.Connection con =
Once I had an instance of java.sql.Connection, I was able to cast it to oracle.jdbc.OracleConnection
Still not sure why the session.connection() method is deprecated.