JDBC handle Oracle Object response



I have one stored function return Oracle Object back, but I am not
sure how to handle it in JDBC.

Here is the SQL script:
drop table TestEmpTable;
create or replace type TestEmpType as object (
EmpFirstName varchar(20),
EmpLastName varchar(20)
);
/

create table TestEmpTable (
EmpId number,
EmpDetail TestEmpType
);

create or replace function testGetEmp (emp_id int) return TestEmpType
is
emp TestEmpType;
begin
select empdetail into emp from testemptable where empid=emp_id;
return emp;
end;
/

And here is the code:

CallableStatement stmt = conn.prepareCall("{ ? = call
testGetEmp(?)}");
stmt.registerOutParameter(1, OracleTypes.CURSOR);

Got Exception:
ORA-06550: line 1, column 13:
PLS-00382: expression is of wrong type
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


Any suggestion is highly welcome.

-- Jack

.