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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:20:11+00:00 2026-06-09T07:20:11+00:00

Hi this is my entity StudentEntity.java, @Entity @NamedQueries({ @NamedQuery(name=totalStudentSQLQuery, query=select count(*) as MAX_STUDENT from

  • 0

Hi this is my entity StudentEntity.java,

  @Entity
  @NamedQueries({
    @NamedQuery(name="totalStudentSQLQuery",
                query="select count(*) as MAX_STUDENT from tblstudent"),    
    @NamedQuery(name="queryForPagination",
                query="SELECT s.studentid AS studentid, s.studentname AS studentname, s.contactno AS contactno, s.deptid AS deptid "+
                        "FROM (SELECT Row_number() OVER() AS row_num, studentid, studentname, contactno, deptid FROM   tblstudent order by studentId asc) s" +
                        " WHERE  s.row_num >=:minRow AND s.row_num <=:maxRow")
  })
  @Table(name="TBLSTUDENT")
  public class StudentEntity implements Serializable{

    /**
     * 
     */
    private static final long serialVersionUID = 100034222342L;

    @Id
    @Column(name="STUDENTID")
    private Integer studentId;

    @Column(name="STUDENTNAME")
    private String studentName;

    @Column(name="CONTACTNO")
    private String contactNumber;
    .....
    .....

  }     

I am using Hibernate 4.0 jars for persistence provider, and using JPA ,

My persistense.xml is as follows,

  <?xml version="1.0" encoding="UTF-8"?>
  <persistence xmlns="http://java.sun.com/xml/ns/persistence"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
               version="2.0">
    <persistence-unit name="forPractise" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>jdbc/app</jta-data-source>
        <class>com.entity.StudentEntity</class>
        <class>com.entity.DeptEntity</class>
        <properties>
                <property name="hibernate.dialect"  value="org.hibernate.dialect.DerbyDialect"  />
                <property name="hibernate.show_sql" value="true" />
                <property name="hibernate.format_sql" value="true" />               
            </properties>
    </persistence-unit>
  </persistence>

Now when i create a war file of this project and try to deploy in Glassfish server, i get an error
unexpected token: (
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: ( near line 1, column 116 [SELECT s.studentid AS studentid, s.studentname AS studentname, s.contactno AS contactno, s.deptid AS deptid FROM (SELECT Row_number() OVER() AS row_num, studentid, studentname, contactno, deptid FROM tblstudent order by studentId asc) s WHERE s.row_num >=:minRow AND s.row_num <=:maxRow]

can anybody tell me were i am doing the mistake in the NamedQuery,

I am using Derby database.

  • 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-09T07:20:13+00:00Added an answer on June 9, 2026 at 7:20 am

    If you want to use the classic SQL database dipendent you have to annotate your query with
    @NamedNativeQuery.

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

Sidebar

Related Questions

i have a Gift entity, this entity has a sender, and a receiver...both from
I try to use this mapping : @Entity @Table(name=ecc.\RATE\) @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name=DISCRIMINATOR, discriminatorType= DiscriminatorType.STRING) public
If I have something like this @Entity public class Facility { ... @ManyToOne @JoinColumn(name=CUSTOMER_FK)
Please check this Entity: @Entity @Table(name = css_empresa) public class Empresa extends EntidadContactable implements
I have this Entity called 'Operation': @Entity @Table(name=operation) public class Operation implements Serializable {
I'm have an issue with this entity query that I am hoping to get
My situation is this: We have a superclass, MyAbstractEntity @Entity @Table(name = MyTable) @Inheritance(strategy
I have a class hierarchy like this: @Entity @Table (name=call_distribution_policies) @Inheritance (strategy=InheritanceType.JOINED) public class
I have a service that gets a JPA entity from outside code. In this
I have this entity: public class Product { public string Name { get; set;

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.