create a procedure in your sql by using the following code.
create or replace procedure first-procedure(x in number,y out number)
begin
y:=x*x;
end;
write your sql connection code in hibernate configuration file. In your hibernate client application get the session obj. On the session object call the connection() method and get the connection.
create a procedure in your sql by using the following code.
create or replace procedure first-procedure(x in number,y out number)
begin
y:=x*x;
end;
write your sql connection code in hibernate configuration file.In your hibernate client application get the session obj.On the session object call the connection() method and get the connection.
In order to call a stored procedure using the hibernate , define a named query for a persistent class mapping document. Then call the named query from your java application .Example is given in the Hibernate Reference documentation as follows:-
First create a stored procedure in your database as,
CREATE OR REPLACE FUNCTION selectAllEmployments
RETURN SYS_REFCURSOR
AS
st_cursor SYS_REFCURSOR;
BEGIN
OPEN st_cursor FOR
SELECT EMPLOYEE, EMPLOYER,
STARTDATE, ENDDATE,
REGIONCODE, EID, VALUE, CURRENCY
FROM EMPLOYMENT;
RETURN st_cursor;
END;
Then in the mapping document create a named query as follows:-