Home » Developer & Programmer » JDeveloper, Java & XML » Call Stored Proc' with Array of Objects
Call Stored Proc' with Array of Objects [message #349267] Fri, 19 September 2008 10:05 Go to next message
welshgaz
Messages: 4
Registered: September 2008
Junior Member
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
Re: Call Stored Proc' with Array of Objects [message #349270 is a reply to message #349267] Fri, 19 September 2008 10:17 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
OracleŽ Database JDBC Developer's Guide and Reference
Chapter 18 Working with Oracle Collections

Regards
Michel
Previous Topic: I Can't launch sqlplus from JDeveloper
Next Topic: Problem in OA framework while using jdeveloper in oracle apps 11.5.10
Goto Forum:
  


Current Time: Thu Mar 28 16:26:04 CDT 2024