users@glassfish.java.net

Re: NamedStoredProcedureQuery gets no result

From: <glassfish_at_javadesktop.org>
Date: Mon, 10 May 2010 14:39:53 PDT

Yes, with the help of a friend I have resolved the issue.

This is the code to declare the NamedStoredProcedureQuery,

@NamedStoredProcedureQuery(
            name="findEmployeeById",
            resultClass=Employee.class,
            procedureName="EMPLOYEEDETAILPKG.GETEMPLOYEEDETAIL",
            parameters={
                @StoredProcedureParameter(name="EMPLOYEEID",
                                queryParameter="EMPLOYEEID", direction=Direction.IN, type=BigDecimal.class),
                @StoredProcedureParameter(name="MYCSR",
                                queryParameter="MYCSR", direction=Direction.OUT_CURSOR)
                }
)

See that the name and the queryParameter in the StoredProcedureParameter has the same string value and they are the same names I use as arguments in the Stored Procedure.

Now I call the following EJB,

public List<Employee> customize()
                                                throws Exception {
            try {
                    Query query = em.createNamedQuery("findEmployeeById");
                query.setParameter("EMPLOYEEID", new BigDecimal(32));
                return (List<Employee>)query.getResultList();
            } catch(Exception ex){
                    throw ex;
                    //Logger.getLogger(EmployeeSessionBean.class.getName()).log(Level.SEVERE, null, ex);
            }
}

that sets only the input parameter "EMPLOYEEID".

Using a application client project to call the ejb I have created an ear file that is deployed on Glassfish.

It works fine.

Best Regards,
Jose
[Message sent by forum member 'josealvarezdelara']

http://forums.java.net/jive/thread.jspa?messageID=469280