I am getting following error while calling oracle stored procedure
Exception Description: The primary key read from the row [DatabaseRecord( retval => null error_message => null)] during the execution of the query was detected to be null. Primary keys must not contain null. Query: ReadAllQuery(name="CCM_ASSIGN_LOOP" referenceClass=CcmAssignLoop )
My Entity is
@Entity
@NamedStoredProcedureQuery(name="CCM_ASSIGN_LOOP", procedureName="TCS.CCM_ASSIGN_LOOP", resultClass=CcmAssignLoop.class,
parameters={
@StoredProcedureParameter(queryParameter="psubno",name="psubno",direction=Direction.IN),
@StoredProcedureParameter(queryParameter="upd_user",name="upd_user",direction=Direction.IN),
@StoredProcedureParameter(queryParameter="ccloop_in",name="ccloop_in",direction=Direction.IN),
@StoredProcedureParameter(queryParameter="ccstage_in",name="ccstage_in",direction=Direction.IN),
@StoredProcedureParameter(queryParameter="retval",name="retval",direction=Direction.OUT),
@StoredProcedureParameter(queryParameter="error_message",name="error_message",direction=Direction.OUT)
}
)
public class CcmAssignLoop implements Serializable {
private static final long serialVersionUID = 1L;
public CcmAssignLoop() {
super();
}
@Id
private String psubno;
private String upd_user;
private String ccloop_in;
private BigDecimal ccstage_in;
private String retval;
private String error_message;
public String getPsubno() {
return psubno;
}
public void setPsubno(String psubno) {
this.psubno = psubno;
}
public String getUpd_user() {
return upd_user;
}
public void setUpd_user(String upd_user) {
this.upd_user = upd_user;
}
public String getCcloop_in() {
return ccloop_in;
}
public void setCcloop_in(String ccloop_in) {
this.ccloop_in = ccloop_in;
}
public BigDecimal getCcstage_in() {
return ccstage_in;
}
public void setCcstage_in(BigDecimal ccstage_in) {
this.ccstage_in = ccstage_in;
}
public String getRetval() {
return retval;
}
public void setRetval(String retval) {
this.retval = retval;
}
public String getError_message() {
return error_message;
}
public void setError_message(String error_message) {
this.error_message = error_message;
}
}
Below is code for calling stored procedure
Query q = tabsEm.createNamedQuery("CCM_ASSIGN_LOOP");
q.setParameter("psubno", subno);
q.setParameter("upd_user", "abc");
q.setParameter("ccloop_in", "xyz");
q.setParameter("ccstage_in", new BigDecimal(5));
// CcmAssignLoop ccmAssignLoop = (CcmAssignLoop)q.getSingleResult();
q.getResultList();
Above mentioned column are not a primary key, whu i am getting this error.
Update:
My procedure on oracle start like
CREATE OR REPLACE PROCEDURE TCS.CCM_ASSIGN_LOOP(PSUBNO IN VARCHAR2, UPD_USER IN VARCHAR2, CCLOOP_IN IN VARCHAR2, CCSTAGE_IN IN NUMBER, RETVAL OUT VARCHAR2, ERROR_MESSAGE OUT VARCHAR2)
IS
OLD_CCSTAGE CCM_USER_INFO.CCLOOP_STAGE%TYPE;
OLD_CCLOOP CCM_USER_INFO.CCLOOP%TYPE;
PROC_CONTRNO CRM_USER_INFO.CONTRNO%TYPE;
TEMP_COUNT NUMBER;
RET_VAL VARCHAR2(100);
V_ERROR_MESSAGE VARCHAR2(256);
i can see RETVAL and RET_VAL, could thiss error due to this?
Regards,