Skip to main content

Calling Oracle Stored Procedure using EclipseLink/Toplink JPA



Lets assume that the Stored Procedure is something like this

MY_PROCEDURE (inputVal number, outputVal out varchar2)


@ annotations approach
-------------------------------------

===>  Define annotations following way in the entity class

@Entity
 @NamedStoredProcedureQuery(name = "xxMethod Namexx", procedureName = "MY_PROCEDURE", parameters = {
        @StoredProcedureParameter(name = "inputVal", queryParameter = "inputVal ", direction = Direction.IN, type = Long.class),
        @StoredProcedureParameter(name = "outputVal ", queryParameter = "outputVal ", direction = Direction.OUT, type = String.class) })
@Table(name = "XXXTABLENAMEXXX")


==> Calling method of Interface should be as follows
 String Method Name (@Param("inputVal")Long inputVal,@Param("outputVal ")String outputVal )


@ declaring in orm.xml approach
-------------------------------------
  ===>  Defining Stored procedure entryon orm.xml

<named-stored-procedure-query name="xxMethod Namexx"
        procedure-name="MY_PROCEDURE">
        <parameter query-parameter="inputVal" name="inputVal" direction="IN"
            type="java.lang.Long" />
        <parameter query-parameter="outputVal " name="outputVal " direction="OUT"
            type="java.lang.String" />
    </named-stored-procedure-query>

 
==> Calling method of Interface should be as follows
 String Method Name (@Param("inputVal")Long inputVal,@Param("outputVal ")String outputVal )

Comments

  1. Customer help staff through Live Chat or e-mail and the friendly employees at the high NetEnt casinos will present assistance. To make it simpler for players to get started, we certain that|be certain that|ensure that} the registration process is straightforward and quick. 1xbet Alex is an experienced iGaming writing, having worked in the industry since 2015. He covers all aspects of iGaming, with a particular interest in sports.

    ReplyDelete

Post a Comment

Popular posts from this blog

Convert Clob to String in Java

import java.sql.Clob; private String clobToStringConversion(Clob clb) throws IOException, SQLException {         if (clb == null) {             return null;         }         StringBuffer str = new StringBuffer();         String data = null;         BufferedReader bufferRead = new BufferedReader(clb.getCharacterStream());         while ((data = bufferRead.readLine()) != null) {             str.append(data);         }         return str.toString();     }