How to call Oracle function from eclipselink [message #652481] |
Fri, 04 February 2011 09:06 |
imran raza khan Messages: 18 Registered: January 2011 |
Junior Member |
|
|
Hi All,
I want to call oracle function which is getting two varchar parameter and returning one varchar.
I tried to use @NamedStoredProcedureQuery, but getting following error
04-Feb-2011 02:54:48:083 ERROR [pool-1-thread-1] - Error==
Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'RANDOMPIN'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error Code: 6550
Call: BEGIN RandomPin(tpin=>?, p_msisdn=>?, p_stat=>?); END;
bind => [=> tpin, 00, G]
Query: ReadAllQuery(name="callTelePin" referenceClass=TelePin )
Regards,
imran
|
|
|
Re: How to call Oracle function from eclipselink [message #652482 is a reply to message #652481] |
Fri, 04 February 2011 09:18 |
imran raza khan Messages: 18 Registered: January 2011 |
Junior Member |
|
|
Hi,
Following is code of entity
@Entity
@NamedStoredProcedureQuery(
name="callTelePin",
resultClass=TelePin.class,
procedureName="RandomPin",
returnsResultSet=true,
parameters={
@StoredProcedureParameter(queryParameter="tpin" ,direction=Direction.OUT, jdbcType = Types.VARCHAR, type=String.class),
@StoredProcedureParameter(queryParameter="p_msisdn", direction=Direction.IN, type=String.class),
@StoredProcedureParameter(queryParameter="p_stat", direction=Direction.IN, type=String.class)
}
)
public class TelePin implements Serializable {
private static final long serialVersionUID = 1L;
public TelePin() {
super();
}
@Id
private String tpin;
private String p_msisdn;
private String p_stat;
public String getTpin() {
return tpin;
}
public void setTpin(String tpin) {
this.tpin = tpin;
}
public String getP_msisdn() {
return p_msisdn;
}
public void setP_msisdn(String p_msisdn) {
this.p_msisdn = p_msisdn;
}
public String getP_stat() {
return p_stat;
}
public void setP_stat(String p_stat) {
this.p_stat = p_stat;
}
}
and following is code snippet how i am calling
Query q2 = tabsEM.createNamedQuery("callTelePin");
q2.setParameter("p_msisdn", '3288009');
q2.setParameter("p_stat", "G");
tp = (TelePin) q2.getSingleResult();
System.out.println("Dear Customer, Your generated pincode is ="+tp.getTpin());
Regards,
imran
[Updated on: Fri, 04 February 2011 09:19] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03399 seconds