Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > Java to call Stored Pro'c with object array ??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-19-08, 12:07
welshgaz welshgaz is offline
Registered User
 
Join Date: Sep 2008
Posts: 2
Java to call Stored Pro'c with object array ??

Not sure if I should put this in PL/SQL or here but anyway...

I'm trying to call a stored proc' with an array of user defined objects but i keep getting 'java.sql.SQLException: Fail to convert to internal representation'

Can anyone please help !?!?!?!?

Heres my java code

Code:
HashMap map = new HashMap(); try { map.put("ZORA.GROUP_DATA", Class.forName("GroupDataBean")); } catch (ClassNotFoundException e) { System.out.println("GroupDataBean class not found for SQL mapping"); System.out.println(e); } connection.setTypeMap(map); ArrayDescriptor desc1 = ArrayDescriptor.createDescriptor("ZORA03.GROUP_DATA_ARRAY", connection); GroupDataBean array[] = new GroupDataBean [values.size()]; array = (GroupDataBean[]) values.toArray(array); ARRAY groupDataArray = new oracle.sql.ARRAY (desc1, connection, array); /* SQL Exception thrown at this point */

Here is the GroupDataBean descriptor...

Code:
public class GroupDataBean { private int corr_; private int gin; private int old_event; private int event; ... Various getters and setters ...

Heres the Stored Proc' (all I want at this moment in time is to be able to call the SP wit hteh array so it does nothing currently)

Code:
CREATE OR REPLACE TYPE GROUP_DATA AS OBJECT ( corr NUMBER, gin NUMBER, old_event NUMBER, event NUMBER); / CREATE OR REPLACE TYPE GROUP_DATA_ARRAY AS TABLE OF GROUP_DATA; / create or replace type STR_ARRAY as table of varchar2 (20); / CREATE OR REPLACE procedure InsertMeeting(meetingNo in number, details in varchar2, memberId in STR_ARRAY, obj_g IN GROUP_DATA_ARRAY, value OUT NUMBER) as temp_obj group_data := group_data(0,0,0,0); begin temp_obj := obj_g(1); for i in 1..memberId.count loop value := temp_obj.corr; end loop; end; /

Can anyone please help ?

Thanks
- G
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On