wood burning stoves
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Complex data object returned from oracle" Watch "Complex data object returned from oracle" New topic

Complex data object returned from oracle

Din Carl

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.

Rob Spoor

Joined: Oct 27, 2005
Posts: 20276

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

How To Ask Questions How To Answer Questions
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141

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,
I agree. Here's the link: http://aspose.com/file-tools
subject: Complex data object returned from oracle
It's not a secret anymore!