If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
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, 11: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

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