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

  • Home
  • SEARCH
  • 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 5956633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:17:06+00:00 2026-05-22T18:17:06+00:00

When I execute @NamedQuery(name = GroupsHasStudent.findByGroupsidGroups, query = SELECT g FROM GroupsHasStudent g WHERE

  • 0

When I execute

@NamedQuery(name = “GroupsHasStudent.findByGroupsidGroups”, query = “SELECT g FROM GroupsHasStudent g WHERE g.groupsHasStudentPK.groupsidGroups = :groupsidGroups”),

of GroupsHasStudent entity, the result is generated correct. But another NativeQuery

getEntityManager().
            createNativeQuery(
            "SELECT d.idDiscipline, d.name, gy.idGroupsYear, gy.year, g.idGroups "
            + "FROM Discipline d, Groupsyear gy, Groups g, GroupsHasStudent ghs "
            + "WHERE ghs.groupsHasStudentPK.groupsidGroups=2").
            getResultList();

throws the Exception

Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
Table 'mydb.groupshasstudent' doesn't exist

Actually I do don’t have such table in db, but the correct name is *groups_has_student* which is specified in @Table:

(My entity:)

@Entity
@Table(name = "groups_has_student")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "GroupsHasStudent.findAll", query = "SELECT g FROM GroupsHasStudent g"),
    @NamedQuery(name = "GroupsHasStudent.findByGroupsidGroups", query = "SELECT g FROM GroupsHasStudent g WHERE g.groupsHasStudentPK.groupsidGroups = :groupsidGroups"),
    @NamedQuery(name = "GroupsHasStudent.findByStudentUserslogin", query = "SELECT g FROM GroupsHasStudent g WHERE g.groupsHasStudentPK.studentUserslogin = :studentUserslogin")})
public class GroupsHasStudent implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected GroupsHasStudentPK groupsHasStudentPK;

    public GroupsHasStudent() {
    }

And even when I rename table in mysql to groupshasstudent there is another Exception

Unknown column 'ghs.groupsHasStudentPK.studentUserslogin' in 'where clause'

І це сумно..

  • 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-05-22T18:17:07+00:00Added an answer on May 22, 2026 at 6:17 pm

    It’s not a native (SQL) query, it’s a JPQL query, therefore you should use createQuery() instead of createNativeQuery().

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

Sidebar

Related Questions

I am trying to execute a namedquery @NamedQuery(name=getEmployeeDetails,query=select e.username,e.email,e.image,e.firstname,e.lastname from Employee e where e.empid=?1)
Given this Hibernate snippet @org.hibernate.annotations.NamedQueries({ @org.hibernate.annotations.NamedQuery( name = ASSIGNED_CONTINGENCIES, query = select ctg.id from
I have an entity with the following named query: @NamedQuery(name = findAllGarbage, query =
cursor.execute(SELECT user_id FROM myapp_location WHERE\ GLength(LineStringFromWKB(LineString(asbinary(utm), asbinary(PointFromWKB(point(%s, %s)))))) < %s\ ,(user_utm_easting, user_utm_northing, 500)); This
I would like to execute an OS command from my ruby script but I
I execute a query that calls a SP, that SP returns data... but when
how to execute a propel query? For example this: $c = new Criteria(); $c->add(AuthorPeer::NAME,
I execute a bash script from php with shell_exec. But the php script waits
How to execute a query in MS Access db from Excel VBA code or
I execute a query in JDBC delete * from mytable where ... I got:

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.