Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] StoredProcedureCall, ReadAllQuery exception

Excuse me. This is the stored procedure,
 
CREATE OR REPLACE package body employeedetailpkg as
   procedure getEmployeeDetail(employeeId in NUMBER, myCsr out csr)
   is
   begin
      open myCsr for 
         select * from employee
   where emp_id = employeeId;
   end getEmployeeDetail;
end;

Sent: Wednesday, April 14, 2010 9:36 PM
Subject: [eclipselink-users] StoredProcedureCall, ReadAllQuery exception

Hi,
 
I am trying several StoredProcedureCall methods.
 
This one works ok,
 
public static void getEmployees() {
        StoredProcedureCall spcall = new StoredProcedureCall();
        spcall.setProcedureName("EMPLOYEEPKG.GETALLEMPLOYEES");
        spcall.useNamedCursorOutputAsResultSet("MYCSR");
 
        List<DatabaseRecord> employees = (Vector) getSession().executeSelectingCall(spcall);
 
        for(DatabaseRecord dr: employees) {
            System.out.println("EMP_ID => " + dr.get("EMP_ID"));
            System.out.println("F_NAME => " + dr.get("F_NAME"));
            System.out.println("L_NAME => " + dr.get("L_NAME"));
            System.out.println(); System.out.println();
        }
}
 
But the following throws an exception,
 
public static void getEmployee(BigDecimal employeeId) {
        StoredProcedureCall spcall = new StoredProcedureCall();
        spcall.setProcedureName("EMPLOYEEDETAILPKG.GETEMPLOYEEDETAIL");
        spcall.addNamedArgument("EMP_ID", "employeeId");
        spcall.useNamedCursorOutputAsResultSet("MYCSR");
 
        ReadAllQuery query = new ReadAllQuery();
        query.setReferenceClass(Employee.class);
        //query.setEJBQLString("SELECT OBJECT(emp) FROM Employee emp WHERE emp.empId = ?1");
        query.setCall(spcall);
        query.addArgument("EMP_ID");
 
        Vector args = new Vector();
        args.add(employeeId);
 
        getSession().executeQuery(query, args);
 }
 
Here is the exception,
 
[EL Info]: 2010-04-14 21:11:20.125--DatabaseSessionImpl(31789152)--Thread(Thread[main,5,main])-- login successful
Exception in thread "main" Local Exception Stack:
[EL Warning]: 2010-04-14 21:11:20.234--DatabaseSessionImpl(31789152)--Thread(Thread[main,5,main])--Exception [EclipseLink-6007] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.QueryException
Exception [EclipseLink-6007] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.QueryException
Exception Description: Missing descriptor for [class model.Employee].
Query: ReadAllQuery(referenceClass=Employee )
Exception Description: Missing descriptor for [class model.Employee].
Query: ReadAllQuery(referenceClass=Employee )
        at org.eclipse.persistence.exceptions.QueryException.descriptorIsMissing(QueryException.java:433)
        at org.eclipse.persistence.queries.ObjectLevelReadQuery.checkDescriptor(ObjectLevelReadQuery.java:660)
        at org.eclipse.persistence.queries.ObjectLevelReadQuery.prePrepare(ObjectLevelReadQuery.java:1895)
        at org.eclipse.persistence.queries.ObjectLevelReadQuery.checkPrePrepare(ObjectLevelReadQuery.java:748)
        at org.eclipse.persistence.queries.ObjectLevelReadQuery.checkEarlyReturn(ObjectLevelReadQuery.java:681)
        at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:619)
        at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
        at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:432)
        at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2322)
        at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
        at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
        at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181)
        at testapplication.Test.getEmployee(Test.java:90)
        at testapplication.Test.main(Test.java:41)
Java Result: 1
 
What does it mean?
 
Thanks in advanced,
Jose


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Back to the top