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 3281536
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:49:36+00:00 2026-05-17T19:49:36+00:00

Oracle supports a query syntax where a table is joined to an Oracle collection

  • 0

Oracle supports a query syntax where a table is joined to an Oracle collection type (Nested table or VARRAY). This semantic can be used instead of the in (1,2,3) syntax in SQL, and allows an array of values to be bound to the query. This can be done using Oracle’s JDBC driver.

This type of query is known as a Pickler Fetch. It is much more scalable than using SQL IN Lists. My application could have ~10,000 values in the collection.

My problem is that I am new to Hibernate (we are using Hibernate 3.2.5 and Spring 2.0.6) and do not see how this semantic can be implemented using Hibernate.
Typically a JDBC implementation would work like this:
Define a user defined type in the database using CREATE type in SQL*Plus
CREATE OR REPLACE TYPE NUMBER_LIST_TYPE AS TABLE OF number;

In Java:

import java.sql.*;
import oracle.sql.ArrayDescriptor;
import oracle.sql.ARRAY;
import oracle.jdbc.*;

/* The oracle collection is described */
            ArrayDescriptor oracleCollection = 
                ArrayDescriptor.createDescriptor("NUMBER_LIST_TYPE",conn);

PreparedStatement stmt = conn.prepareStatement(
             " SELECT ename,empno FROM emp                                "
            +"  WHERE empno IN (                                          "
            +"   SELECT * FROM   TABLE( CAST ( ? as NUMBER_LIST_TYPE ) )  "
            +"   )                                                        "
            );

/* define our java array */
            int[] javaArray1 = { 7369,7566,7782 };

            /* define our oracle array */
            ARRAY jdbcArray1 = new ARRAY (oracleCollection, conn, javaArray1);

            /* bind that array to our statement bind variable */
            stmt.setObject(1,jdbcArray1);

            /* execute the query and browse the result */
            ResultSet r=stmt.executeQuery(); 
            while(r.next()){ 
             System.out.println(
                "\t"+"\t"+r.getString(2)+": "+r.getString(1)); 
            }

Now how can I implement something like this using Hibernate?

  • 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-05-17T19:49:36+00:00Added an answer on May 17, 2026 at 7:49 pm

    I researched further, and if we move to the current Hibernate version I could create my own JDBC DAO. I would have to implement the org.hibernate.jdbc.Work interface, but its doable. It would be working around hibernate. An example of the approach is here:
    http://www.informit.com/guides/content.aspx?g=java&seqNum=575

    I’d still like to know if there is a better way to do this though. Especially since the Work Interface is not available in 3.2.5

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Like Oracle, SQL Server supports parameter defaults in stored procedures. Oracle syntax: CREATE OR
In Oracle, I have a table with a column of data type NUMBER. I
In Oracle, I have a table with a column (X) which can have strings
Oracle SQL can do hierarchical queries since v2, using their proprietary CONNECT BY syntax.
I understand that Oracle supports multiple character sets, but how can determine if the
Oracle does not support a bit datatype or any other type for true/false scenarios.
Oracle doesn't support the TIME datatype, but you can use DATE to store a
I want to run a query on both Oracle and SQL Server. The problem
This question might be lazy question. While I was using netbean to run query
i'm trying to write an Oracle query that sorts the results in the same

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.