Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Custom Object IN Parameter
Custom Object IN Parameter [message #1796452] Sat, 13 October 2018 09:45 Go to next message
Wousang 1932 is currently offline Wousang 1932Friend
Messages: 1
Registered: October 2018
Junior Member
I have stored procedures working when i pass in basic java objects (String, Long, etc.) but i cant seem to pass in my own Entity/Object without getting the following error:

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Invalid column type
Error Code: 17004
Call: BEGIN sar_ops.input_rule_no_response(operation_id_in=>?, executing_usr_id_in=>?, rule_obj_in=>?, success_ind_out=>?, error_cur_out=>?); END;
    bind => [MO1234ABCD, TEST, Rule [id=99999, last_updated_by=mike], => success_ind_out, => error_cur_out]
Query: ResultSetMappingQuery(name="input_rule_no_response" )

From reading up i thought my code would work (see below). I added the @Struct annotation and gave it the name of the matching oracle object from the Database. I was under the impression from the eclispelink documentation i would only need the @Embeddable and @Struct annotations on my class, but i have also added the @Entity annotation whilst testing a theory but still get the same error. I feel i must be missing some form of configuration for eclipselink to know that the object im passing in is a Java class representation of the Oracle object it expects.

Oracle Object and stored proc definition:
ROCEDURE input_rule_no_response
      operation_id_in     IN operation_id_type
     ,executing_usr_id_in IN usr_id%TYPE
     ,rule_obj_in         IN rule_obj_type
     ,success_ind_out     OUT uttype.boolean_type
     ,error_cur_out       OUT SYS_REFCURSOR
   ) IS

   id                 NUMBER(10),
   last_updated_by        VARCHAR2(100)

My stored procedure is defined as:
        resultClasses={DBError.class, Rule.class},
                @StoredProcedureParameter(name="operation_id_in", mode=ParameterMode.IN, type=String.class),
                @StoredProcedureParameter(name="executing_usr_id_in", mode=ParameterMode.IN, type=String.class),
                @StoredProcedureParameter(name="rule_obj_in", mode=ParameterMode.IN, type=Rule.class),
                @StoredProcedureParameter(name="success_ind_out", mode=ParameterMode.OUT, type=Character.class),
                @StoredProcedureParameter(name="error_cur_out", mode=ParameterMode.REF_CURSOR, type=void.class)

And my entity looks like:
@Struct(name="rule_obj_type", fields={"id","last_updated_by"})
public class Rule implements Serializable{

    private static final long serialVersionUID = 4768354320081279604L;

    private long id;

    private String last_updated_by;

    public long getId() {
        return id;

    public void setId(long id) { = id;

    public String getLast_updated_by() {
        return last_updated_by;

    public void setLast_updated_by(String last_updated_by) {
        this.last_updated_by = last_updated_by;

    public String toString() {
        return "Rule [id=" + id + ", last_updated_by="
                + last_updated_by + "]";

And my execute code:
public boolean inputRuleNoResponse(Rule sar) {
        StoredProcedureQuery query = em.createNamedStoredProcedureQuery("input_rule_no_response");
        query.setParameter("operation_id_in", "MO1234ABCD");
        query.setParameter("executing_usr_id_in", "TEST");
        query.setParameter("rule_obj_in", sar);
        return query.execute();

I am trying to stick to the JPA defined annotations (javax.persistence.*) where possible in the NamedStoredProcedureQuery configuration. Is this possible?
Re: Custom Object IN Parameter [message #1798679 is a reply to message #1796452] Thu, 22 November 2018 15:44 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
This looks remarkably similar to the question posted here in 2015, even down to adding the @Entity annotation which shouldn't be there. Are you getting this as an example somewhere? The solution is the same - you are specifying the java type to be built from the results as if it were an out parameter when you need to specify the jdbcType and JdbcTypeName of what you want passed to the driver, otherwise all it will get is a Rule instance that it doesn't know anything about. See
Previous Topic:Local Exception Stack:
Next Topic:Composite persistence unit
Goto Forum:

Current Time: Tue Jul 23 13:17:02 GMT 2024

Powered by FUDForum. Page generated in 0.03602 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top