users@glassfish.java.net

EclipseLink _at_NamedStoredProcedureQuery with iAnywhere (ASA10) and jConnect

From: <glassfish_at_javadesktop.org>
Date: Tue, 16 Sep 2008 11:05:25 PDT

I'm trying to use EclipseLink @NamedStoredProcedureQuery with GlassFishv2ur2, Sybase ASA10 (iAnywhere, SQL Anywhere) and jConnect (jconn3). I am trying a simple example with two IN parameters and one OUT parameter. The OUT parameter is a simple integer representing a Boolean with a 1 or 0 return value. I have triend all sorts of options on my query declaration and always end up with the same result which is:

"Internal Exception: java.sql.SQLException: JZ0SG: A CallableStatement did not return as many output parameters as the application had registered for it."

I have been wondering if it is a problem with jConnect drivers so I tried getting the iAnywhere driver to work (JDBC-ODBC type 2 driver) but had no luck getting that to do anything. I've tried DataDirect but that technically only supports ASE (plus the documentation is worthless when Sybase is concerned) so no luck there. Any advice or pointers? Ideas? I'm open to just about anything. :-)

I have the following code:

@Entity
@NamedStoredProcedureQuery(name="Fund.p_is_ifee_end", procedureName="p_is_ifee_end",
                resultClass=void.class,
                returnsResultSet=false,
                parameters={
                        @StoredProcedureParameter(queryParameter="fund_id", name="fund_id"),
                        @StoredProcedureParameter(queryParameter="param_date", name="param_date"),
                        @StoredProcedureParameter(queryParameter="fee_end", name="fee_end",
                                direction=Direction.OUT, jdbcType = Types.INTEGER, type = Integer.class)
                }
)
public class Fund implements Serializable ...

the calling code looks like this:

Query crystalizeQuery = em.createNamedQuery("Fund.p_is_ifee_end");
crystalizeQuery.setParameter("fund_id", fund.getId());
Integer b = null;
crystalizeQuery.setParameter("param_date", pnlDate);
crystalizeQuery.setParameter("fee_end", b);

and the error message is:

Caused by: java.sql.SQLException: JZ0SG: A CallableStatement did not return as many output parameters as the application had registered for it.
        at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
        at com.sybase.jdbc3.jdbc.ParamManager.new(Unknown Source)
        at com.sybase.jdbc3.jdbc.ParamManager.doGetOutValueAt(Unknown Source)
        at com.sybase.jdbc3.jdbc.ParamManager.doGetOutObjectAt(Unknown Source)
        at com.sybase.jdbc3.jdbc.ParamManager.getOutObjectAt(Unknown Source)
        at com.sybase.jdbc3.jdbc.SybCallableStatement.getObject(Unknown Source)
        at org.eclipse.persistence.internal.databaseaccess.DatabaseCall.buildOutputRow(DatabaseCall.java:216)
        at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.buildOutputRow(DatabaseAccessor.java:223)
        ... 46 more
[Message sent by forum member 'euqaz' (euqaz)]

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