Skip to main content

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

The row does seem to have the id column now, so the error is odd.  Check your
descriptor as see if its primaryKeyFields are what you think they are, do
you have an orm.xml or are you overriding the id column somewhere.



khaskett wrote:
> 
> I changed the Stored Proc to be an INOUT param and I changed the call
> from my code to be -
> 
> call.addNamedInOutputArgumentValue(CpUserManagerImpl.PARAM_USER_ID,
> argumentValue,
>     CpUserManagerImpl.PARAM_USER_ID, java.lang.String.class);
> call.addNamedOutputArgument(CpUserManagerImpl.PARAM_AGENT_NUMBER);
> 
> But I am still getting an error -
> [6/10/09 15:21:15:703 CDT] 0000003b SystemOut     O [EL Fine]:
> 2009-06-10
> 15:21:15.687--ServerSession(2028632298)--Connection(430447016)--Thread(T
> hread[WebContainer : 1,5,main])--EXECUTE spMSIRetrieveByUserID
> @paramUserID  = ? , @paramAgentNumber = ? , @paramAgentSubcode = ? ,
> @paramInitials = ? , @paramLastName = ? , @paramFirstName = ? ,
> @paramEmail = ? , @paramReturn = ?
> 	bind => [KHASKETT => paramUserID , => paramAgentNumber, =>
> paramAgentSubcode, => paramInitials, => paramLastName, =>
> paramFirstName, => paramEmail, => paramReturn]
> [6/10/09 15:21:15:765 CDT] 0000003b SystemOut     O [EL Warning]:
> 2009-06-10
> 15:21:15.765--UnitOfWork(298193350)--Thread(Thread[WebContainer :
> 1,5,main])--Exception [EclipseLink-6044] (Eclipse Persistence Services -
> 1.1.1.v20090430-r4097):
> org.eclipse.persistence.exceptions.QueryException
> Exception Description: The primary key read from the row
> [DatabaseRecord(
> 	paramUserID  => khaskett
> 	paramAgentNumber => XXXXXXXXX
> 	paramAgentSubcode => YYYYYYY
> 	paramInitials => ABC
> 	paramLastName => Some
> 	paramFirstName => One
> 	paramEmail => SOne@xxxxxxx
> 	paramReturn => 0)] during the execution of the query was
> detected to be null.  Primary keys must not contain null.
> Query: ReadObjectQuery(referenceClass=CpUser )
> 
>>From the results it would appear that paramUserID should be getting set
> now.
> 
> -----Original Message-----
> From: eclipselink-users-bounces@xxxxxxxxxxx
> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of James
> Sutherland
> Sent: Wednesday, June 10, 2009 12:34 PM
> To: eclipselink-users@xxxxxxxxxxx
> Subject: 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-tp23890538p24076370.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top