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 9155769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:39:14+00:00 2026-06-17T12:39:14+00:00

The following query throws the exception: Query query = session.createQuery(from Associate as a order

  • 0

The following query throws the exception:

 Query query = session.createQuery("from Associate as a order by a.username asc");
 associates = query.list();

org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [ca.mypkg.model.Associate#0]

If I create an entry in the database with id of 0 it works just fine. I don’t really get it because I’m just trying to load all the entries in the db not just a specific one.

Similar questions I’ve found have been concerned with trying to load an object with a given ID I’m doing no such thing.

Associate class:

@Table(name = "user")
@XmlRootElement(name = "associate")
public class Associate implements Serializable {

private String username;
private String password;
private String firstName;
private String lastName;
private String userType;
private int id;
private String email;
private String isActive;
private Department dept;
private String lastUpdated;
private String associate_type;
// ...
@Id
@GeneratedValue
public int getId() {
    return id;
}

@OneToOne
@JoinColumn(name = "dept")
public Department getDept() {
    return dept;
}
  • 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-17T12:39:15+00:00Added an answer on June 17, 2026 at 12:39 pm

    From my experience this type of error message usually means it does not find joined entity by mentioned id, and not the entity requested in the query (Associate, in your case).
    My guess is that Associate class contains a join entity which has primitive type primary key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following WMI query throws an exception at serverProtocolsManagement.Get() when sqlHost is an invalid
The following query: SELECT DISTINCT ClassName FROM SiteTree ORDER BY ClassName is returning things
The following query matches the ID of electors with the corresponding elector from voting
The following query: select unnest(Table2.L) as X, unnest(Table1.O) from Table1, Table2 where Table1.code =
I am writing following code to fetch a row from table: $query = SELECT
The following code throws the exception EntitySqlException: 'Group' is a reserved keyword and cannot
I have the following query that is not working: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema%23> PREFIX i:
Following code I used <sql:query dataSource=jdbc/crawl var=rs> select * from vsites where site like
I'm trying to pull records in Hibernate using the following Criteria query. Security result
I have the following: @Entity @NamedQuery(name = listCarsBySecurity, query = SELECT c FROM Car

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.