aspose file tools*
The moose likes Object Relational Mapping and the fly likes stored procedure exception (primary key null) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "stored procedure exception (primary key null)" Watch "stored procedure exception (primary key null)" New topic
Author

stored procedure exception (primary key null)

Rene Ummels
Greenhorn

Joined: Feb 12, 2010
Posts: 11
Hi,

We have the following exception with the code below. Does anybody know the solution?

Thanks,
Rene


Local Exception Stack:
Exception [EclipseLink-6044] (Eclipse Persistence Services - 2.0.0.v20091127-r5931): org.eclipse.persistence.exceptions.QueryException
Exception Description: The primary key read from the row [DatabaseRecord(
=> 42427110080034
=> 99
=> 428110080034)] during the execution of the query was detected to be null. Primary keys must not contain null.
Query: ReadObjectQuery(referenceClass=Ported )
at org.eclipse.persistence.exceptions.QueryException.nullPrimaryKeyInBuildingObject(QueryException.java:863)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:468)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:441)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:635)
at org.eclipse.persistence.queries.ReadObjectQuery.registerResultInUnitOfWork(ReadObjectQuery.java:724)
at org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:438)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:997)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:675)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
at org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:399)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1021)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2863)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1167)






Rene Ummels
Greenhorn

Joined: Feb 12, 2010
Posts: 11
Oh yes, here is also the Network class:

Rene Ummels
Greenhorn

Joined: Feb 12, 2010
Posts: 11
Hi,

The solution was to update the sybase stored procedure from:

to:


and to add and use a Result entity instead, as follows:


In this way, the columns were mapped correctly.


br,
Rene
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: stored procedure exception (primary key null)