Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8017759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:56:05+00:00 2026-06-04T20:56:05+00:00

I’m not able to find a way to do something that seems to me

  • 0

I’m not able to find a way to do something that seems to me as a common task.

I have

CREATE TYPE MyType AS OBJECT (field1 int, field2 int);
CREATE PROCEDURE SP_TEST (obj IN MyType) AS ....    

How can I call this procedure from Java application ? I’m using hibernate and c3p0 connection pool that hides native jdbc connection, so I cannot cast its proxy connection to OracleConnection. I found that c3p0 has rawConnectionOperation, but I don’t understand how to accomplish my task using it.

Any help is greatly appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:56:07+00:00Added an answer on June 4, 2026 at 8:56 pm

    In case someone has a similar problem, it can be solved like :

    public class CallSPTest
    {
       public static STRUCT createSTRUCT(oracle.sql.StructDescriptor structDescriptor, 
        java.sql.Connection connection, java.lang.Object[] objects) 
        throws java.sql.SQLException
        {
           return new STRUCT(structDescriptor,connection,objects);
        }
        public void testSP(Session s)
        {
           t = s.beginTransaction();
           s.doWork(new Work()
            {
    
                @Override
                public void execute(Connection connection) throws SQLException
                {
                    try
                    {
                        CallableStatement cs = connection.prepareCall("call SP_TEST(?)");                       
                        final Object[] values = new Object[]{1,2};
    
                        java.sql.Connection connect = 
      org.hibernate.jdbc.BorrowedConnectionProxy.getWrappedConnection(connection);
                        C3P0ProxyConnection castCon = (C3P0ProxyConnection) connect;
                        Method m = StructDescriptor.class.getMethod("createDescriptor", new Class[]{ String.class,Connection.class});
                        Object[] args = new Object[]{"MyType",C3P0ProxyConnection.RAW_CONNECTION};
                        StructDescriptor desc1 =(StructDescriptor) castCon.rawConnectionOperation(m, null, args);
    
                        Method m2 = CallSPTest.class.getMethod("createSTRUCT",
                                new Class[]{StructDescriptor.class, Connection.class,Object[].class});
    
                        args = new Object[] {desc1,C3P0ProxyConnection.RAW_CONNECTION,values};
                        final STRUCT struct1 = (STRUCT)castCon.rawConnectionOperation(m2,null,args);
                        cs.setObject(1, struct1, Types.STRUCT);
                        int aff_rows = cs.executeUpdate();
                    }
                    catch (Exception e)
                    {
                        System.out.print(e.getMessage());
                    }
                }
            });
        } 
        catch (Exception e)
        {
            System.out.print(e.getMessage());
        }
        finally
        {
            if (null != t)
            {
                t.rollback();                
            }
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.