Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8017919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:58:54+00:00 2026-06-04T20:58:54+00:00

I have 2 entity classes: Shipvia and Route. My Shipvia is working fine. Route

  • 0

I have 2 entity classes: Shipvia and Route. My Shipvia is working fine. Route entity class is an exact copy of it, but of course tailored for the tablename and fields. Both classes are read using this method:

public class RetrieveResultList {

private static final EntityManagerFactory FACTORY = Persistence.createEntityManagerFactory("EntityLibraryPU");

    public static <T> List<T> retrieveResultList(Class<T> type) {
        EntityManager entityManager = FACTORY.createEntityManager();
        String tablename = type.getName(); // figure out table name from **type**
        Query query = entityManager.createNamedQuery(tablename + ".findAll");
        List<T> resultList = query.getResultList();
        entityManager.close();
        return resultList;
    }
}

My working entity class for Shipvia is here: http://pastebin.com/R53tNHyp

My entity class for Route is: http://pastebin.com/8f4L2Z62

Unless I made a mistake somewhere by missing a variable or field, I am not sure why I get the following error when trying to get the resultList from the above method.

I get the following error:

Local Exception Stack: 
Exception [EclipseLink-6044] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.QueryException
Exception Description: The primary key read from the row [ArrayRecord(
ROUTE.ROUTEKEY => null
ROUTE.RUADD_DATE => null
ROUTE.RUADD_TERM => null
ROUTE.RUADD_TIME => null
ROUTE.RUADD_USER => null
ROUTE.RUCHG_DATE => null
ROUTE.RUCHG_NUMB => null
ROUTE.RUCHG_TERM => null
ROUTE.RUCHG_TIME => null
ROUTE.RUCHG_USER => null
ROUTE.ROUTE => null)] during the execution of the query was detected to be null.      
Primary keys must not contain null.
Query: ReadAllQuery(name="Route.findAll" referenceClass=Route sql="SELECT ROUTEKEY, RUADD_DATE, RUADD_TERM, RUADD_TIME, RUADD_USER, RUCHG_DATE, RUCHG_NUMB, RUCHG_TERM, RUCHG_TIME, RUCHG_USER, ROUTE FROM ROUTE")

What’s weird is that if I run the query above

SELECT ROUTEKEY, RUADD_DATE, RUADD_TERM, RUADD_TIME, RUADD_USER, RUCHG_DATE, RUCHG_NUMB, RUCHG_TERM, RUCHG_TIME, RUCHG_USER, ROUTE FROM ROUTE

It returns a perfect result. I am not sure where to start looking for an error!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:58:56+00:00Added an answer on June 4, 2026 at 8:58 pm

    I believe this sql will solve it

    delete from ROUTE where ROUTEKEY is null
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two entity classes annotated in the following way @Entity class A {
I have the following classes: public class Entity<T> where T : Entity<T> { public
I have the following classes in my Model: public abstract class Entity : IEntity
I have two classes, user and role, defined as: public class User : Entity
I have two entity classes, Student and Committee. I can not post images, but
I have two entity classes: public class Invoice { public int ID { get;
I have two entity classes: Person and Position . public class Person { public
I have 2 classes @Entity @Table(name = user) public class User @Id @Column(name =
I have the following entity classes: public class Usuario implements Serializable { private static
Say I have the following entity classes: public class Order { public int OrderID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.