wood burning stoves 2.0*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "stored procedure exception (primary key null)" Watch "stored procedure exception (primary key null)" New topic

stored procedure exception (primary key null)

Rene Ummels

Joined: Feb 12, 2010
Posts: 11

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


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

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

Rene Ummels

Joined: Feb 12, 2010
Posts: 11

The solution was to update the sybase stored procedure from:


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

In this way, the columns were mapped correctly.

I agree. Here's the link: http://aspose.com/file-tools
subject: stored procedure exception (primary key null)
Similar Threads
JPA and StoredProcedureCall
eclipselink stored procedures with result returned from different tables
call a stored procedure using eclipselink Problem...
Calling Stored Procedure thru JPA
deployed service is working local jboss but not on network but other services are working properly