This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Complex data object returned from oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Complex data object returned from oracle" Watch "Complex data object returned from oracle" New topic
Author

Complex data object returned from oracle

Din Carl
Greenhorn

Joined: Dec 08, 2011
Posts: 1
Hi there,

It is my first time posting question here, and if anything not clear please let me know. I am having trouble with complex object returned from stored procedure. I have something like this:


Then I do this is java:

My issue is when array.getArray() (Point A) is called, then it calls A.readSQL() (Point B) first so that all data is set and saved somewhere. Then at Point C, it calls A.readSQL() again but at this time there no more data to read as it has been read, and the result is I get B object with null values, no exception occurs. I been struggling for 2 days and couldn't figure it out. Everything parses out correctly if I use B as param instead of BLIST.

Please help. Thanks.

Carl
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19552
    
  16

Welcome to the Ranch, Din Carl! Can you please UseCodeTags next time? It makes your code easier to read.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

Carl,
I suggest using Oracle's JDBC thin driver which maps database table types, like your BLIST type, to java.sql.Array and object types, like your types A and B, to java.sql.Struct.
Also, I personally prefer using a PL/SQL stored function, rather than a stored procedure with an OUT parameter.

Good Luck,
Avi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Complex data object returned from oracle
 
Similar Threads
java.sql.SQLData - Oracle object mapping problem
Passing Nested Type from Java to DB
Any replacement for ArrayDescriptor?
Storing Objects using SQLData Interface
Stored Procedure and Java