Announcement Announcement Module
No announcement yet.
Working with Oracle Objects Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Working with Oracle Objects


    I'm working on an application which has the following configuration

    JBoss 4 server
    Spring 2
    Hibernate 3.2.4.GA
    Oracle 10g database (
    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


    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.

  • #2
    Re: Oracle objects

    Managed to solve the first problem by making use of

    java.sql.Connection con =
    org.hibernate.jdbc.BorrowedConnectionProxy.getWrap pedConnection(session.connection());

    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.