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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:46:20+00:00 2026-05-15T22:46:20+00:00

I am using java.sql.SQLData interface to map my java objects to Oracle database types.

  • 0

I am using java.sql.SQLData interface to map my java objects to Oracle database types.

For example, I have an object type Person in Oracle DB defined as:

CREATE OR REPLACE TYPE PERSON AS OBJECT
(
      PERSON_ID NUMBER,
      PERSON_NAME VARCHAR2(100)
);

Corresponding Java type is:

public class Person implements SQLData {

 private String sql_type = "PERSON";
 private int personId;
 private String personName;

 public int getPersonId() {
  return personId;
 }

 public void setPersonId(int personId) {
  this.personId = personId;
 }

 public String getPersonName() {
  return personName;
 }


 public void setPersonName(String personName) {
    this.personName = personName;
 }

 public void readSQL(SQLInput stream, String typeName) throws SQLException 
 {
     this.sql_type=typeName;
     this.personId = stream.readLong();
     this.personName = stream.readString();
 }

 public void writeSQL(SQLOutput stream) throws SQLException 
 {
       stream.writeLong(this.personId);
        stream.writeString(this.personName);
 }
}

This works fine currently and populates Person Objects from database type.

Now, I have a another type and it’s corresponding collection as follows:

CREATE OR REPLACE TYPE SUBJECT AS OBJECT
    (
          SUBJECT_ID NUMBER,
          SUBJECT_NAME VARCHAR2(100)
    );
 -- Corresponding List
 CREATE OR REPLACE TYPE SUBJECT_LIST IS TABLE OF SUBJECT;

I have to create a new entry in type PERSON with this collection as follows:

CREATE OR REPLACE TYPE PERSON AS OBJECT
(
      PERSON_ID NUMBER,
      PERSON_NAME VARCHAR2(100),
      SUBJECT_LIST TYPE SUBJECT_LIST
);

To make this change I have to change my java Person class. I tried adding java.sql.Array parameter but it is not working.

Can you please help here to map the new PERSON Object type to Java type?

Thanks in advance.

–Siddharth

  • 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-15T22:46:20+00:00Added an answer on May 15, 2026 at 10:46 pm

    The documentation of SQLInput (link below) has this on the first line…

    “This interface [ie SQLInput] … is used by the driver behind the scenes, and a programmer never directly invokes SQLInput methods.”

    Are you sure you should be using SQLInput directly? Is there an example you’re following?

    Ref: http://java.sun.com/j2se/1.4.2/docs/api/java/sql/SQLInput.html#readObject%28%29

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

Sidebar

Related Questions

I have implemented java.sql.SQLData in order to bind UDT objects to prepared statements using
I am using java on sql server and I have a DB problem of
I have this issue: first, I execute a SQL query using Java and then
I created and launch the SQLJ Java procedure (using SQL Developer). I have some
I have created a java SE application that uses the mysql database using mysql
I am using JTDS with Java to connect to a Microsoft SQL database. I
I am using java/hibernate/Oracle. i have a list with more than 3000 entries. if
By using g:datePicker on java.sql.Time object that refers to a TIME legacy DB column
I have a problem during an insert in Oracle using Java and JDBC. The
I'm currently wrestling with an Oracle SQL DATE conversion problem using iBATIS from Java.

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.