Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Stored Procedure error

Your procedure must return all of the column values required for the object,
including its primary key paramUserID.  Currently your row does not include
that value.  Perhaps make the PARAM_USER_ID an INOUT param.


khaskett wrote:
> 
> We have a stored Procedure call to a SQL Server database that is erroring
> out. 
> The primary key read from the row [DatabaseRecord(
> 	paramAgentNumber => XXXXXXXXX
> 	paramAgentSubcode => ZZZZZZZ
> 	paramInitials => ABC
> 	paramLastName => SOME
> 	paramFirstName => ONE
> 	paramEmail => SONE@xxxxxxx                                   
> 	paramReturn => null)] during the execution of the query was detected to
> be null.  Primary keys must not contain null.
> 
> Which indicates that part of the primary key is returning null,
> specifically paramReturn.  But the primary key does not include
> paramReturn.
> 
> Here is the call -
> 
>         final ReadObjectQuery readObjectQuery = new
> ReadObjectQuery(CpUser.class);
>         final StoredProcedureCall call = new StoredProcedureCall();
>         call.setProcedureName("spMSIRetrieveByUserID");
>         call.addNamedArgumentValue(CpUserManagerImpl.PARAM_USER_ID,
> argumentValue);
>         call.addNamedOutputArgument(CpUserManagerImpl.PARAM_AGENT_NUMBER);
>        
> call.addNamedOutputArgument(CpUserManagerImpl.PARAM_AGENT_SUBCODE);
>         call.addNamedOutputArgument(CpUserManagerImpl.PARAM_INITIALS);
>         call.addNamedOutputArgument(CpUserManagerImpl.PARAM_LAST_NAME);
>         call.addNamedOutputArgument(CpUserManagerImpl.PARAM_FIRST_NAME);
>         call.addNamedOutputArgument(CpUserManagerImpl.PARAM_EMAIL);
>         call.addNamedOutputArgument(CpUserManagerImpl.PARAM_RETURN);
>         readObjectQuery.setCall(call);
> 
>         return (CpUser) getSession().executeQuery(readObjectQuery);
> 
> Here is the entity -
> 
> @Entity
> public class CpUser extends BaseDomain {
> 
>     // Attributes
>     @Id
>     @Column(name = "paramUserID")
>     private String userId;
> 
>     @Column(name = "paramInitials")
>     private String initials;
> 
>     @Column(name = "paramBinarySession")
>     private String binarySessionID;
> 
>     @Column(name = "paramFirstName")
>     private String firstName;
> 
>     @Column(name = "paramLastName")
>     private String lastName;
> 
>     @Column(name = "paramAgentNumber")
>     private String producer;
> 
>     @Column(name = "paramAgentSubcode")
>     private String contractNumber;
> 
>     @Column(name = "paramEmail")
>     private String emailAddress;
> 
>     @Column(name = "paramReturn")
>     private int result;
> 
> Any ideas on what is wrong?
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Stored-Procedure-error-tp23890538p23967269.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top