File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes how to call stored procedure from hibernate that takes array as input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "how to call stored procedure from hibernate that takes array as input" Watch "how to call stored procedure from hibernate that takes array as input" New topic
Author

how to call stored procedure from hibernate that takes array as input

lavnish lalchandani
Ranch Hand

Joined: Feb 28, 2007
Posts: 79
Database Code

CREATE TYPE array_table AS TABLE OF VARCHAR2 (50); -- Array of String
CREATE TYPE array_int AS TABLE OF NUMBER; -- Array of integers

procedure which takes an array as an input parameter and returns an array as its OUT parameter.
below procedure has 2 parameters -
an array of String as its IN parameter – p_array
an array of Integers as OUT parameter – p_arr_int
CREATE OR REPLACE PROCEDURE SchemaName.proc1 (p_array IN array_table,
len OUT NUMBER,
p_arr_int OUT array_int)
AS
v_count NUMBER;
BEGIN
p_arr_int := NEW array_int ();
p_arr_int.EXTEND (10);
len := p_array.COUNT;
v_count := 0;
FOR i IN 1 .. p_array.COUNT
LOOP
DBMS_OUTPUT.put_line (p_array (i));
p_arr_int (i) := v_count;
v_count := v_count + 1;
END LOOP;
END;
/


how can i call this from hibernate using ( i ) Native SQL ( ii ) Named procedure

lavnish.blogspot.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to call stored procedure from hibernate that takes array as input