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
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...
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)
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