Query syntax exception, table name is not mapped

madhu

I'm using HQL query, pls see the below code.

Entity class:

@Entity
@Table(name = "COUNTRY")
public class Country implements Serializable{

private long countryCode;
private String countryName;

DAO:

public List<Country> getCountryList(){
    List<Country> resultList = null;
    System.out.println("in dao");
    Query query = getSession().createQuery(" from country ctry ");
    resultList =  query.list();


    return resultList;
}

app context.xml:

<beans:property name="annotatedClasses">
  <beans:list>
      <beans:value>com.test.in.ergy.entity.Country</beans:value>
  </beans:list>
</beans:property>

What might be the problem

madhu

I changed my query from HQL to SQL and its working. The query goes below..

String queryString = " select ctry.COUNTRY_CODE, ctry.COUNTRY_NAME from METRICS.COUNTRY ctry ";

    try {
        SQLQuery query = getSession().createSQLQuery(queryString);
        resultList = query.list();
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to get Table Name of mapped entity in Entity Framework Core

From Dev

How to query a table with wildcard in the name

From Dev

C# Syntax Error Near Table Name

From Dev

The type 'X' is not mapped as a Table

From Dev

How to get table syntax ( Query ) in mysql?

From Dev

Use of variable table name in Query

From Dev

Inserting a table name into a query gives sqlite3.OperationalError: near "?": syntax error

From Dev

Display the name of syntax table for the current buffer in Emacs

From Dev

SQL Syntax Error Exception when trying to insert row into table

From Dev

Can Someone explain meaning of this exception? Connection String, Table Name, query syntax are correct

From Dev

SQLite Exception: near "=": syntax error (code 1): , while compiling: UPDATE person_table SET person_name=? WHERE _id =

From Dev

Syntax error on CREATE TABLE SQL query

From Dev

what is the correct syntax for MySQL alter table query?

From Dev

Dynamic Table Name in Propel Query

From Dev

Query table name appended with date

From Dev

Proper Syntax for 3 table SELECT query

From Dev

Syntax error near table_name

From Dev

SQL Syntax Error Exception when trying to insert row into table

From Dev

Can Someone explain meaning of this exception? Connection String, Table Name, query syntax are correct

From Dev

SQL syntax: outer table_name

From Dev

Hibernate QuerySyntaxException, Table not mapped

From Dev

Dynamic Table Name in Propel Query

From Dev

JDBC throws MySQL syntax Exception, despite valid query

From Dev

MySQL Syntax Error Exception when executing Update query

From Dev

How to get all table name on postgresql with Exception?

From Dev

Hibernate 5 "is not mapped" exception

From Dev

Syntax for inner Join query for 4 table

From Dev

Run a query on Dynamic Table Name

From Dev

SQL syntax error on table name

Related Related

  1. 1

    How to get Table Name of mapped entity in Entity Framework Core

  2. 2

    How to query a table with wildcard in the name

  3. 3

    C# Syntax Error Near Table Name

  4. 4

    The type 'X' is not mapped as a Table

  5. 5

    How to get table syntax ( Query ) in mysql?

  6. 6

    Use of variable table name in Query

  7. 7

    Inserting a table name into a query gives sqlite3.OperationalError: near "?": syntax error

  8. 8

    Display the name of syntax table for the current buffer in Emacs

  9. 9

    SQL Syntax Error Exception when trying to insert row into table

  10. 10

    Can Someone explain meaning of this exception? Connection String, Table Name, query syntax are correct

  11. 11

    SQLite Exception: near "=": syntax error (code 1): , while compiling: UPDATE person_table SET person_name=? WHERE _id =

  12. 12

    Syntax error on CREATE TABLE SQL query

  13. 13

    what is the correct syntax for MySQL alter table query?

  14. 14

    Dynamic Table Name in Propel Query

  15. 15

    Query table name appended with date

  16. 16

    Proper Syntax for 3 table SELECT query

  17. 17

    Syntax error near table_name

  18. 18

    SQL Syntax Error Exception when trying to insert row into table

  19. 19

    Can Someone explain meaning of this exception? Connection String, Table Name, query syntax are correct

  20. 20

    SQL syntax: outer table_name

  21. 21

    Hibernate QuerySyntaxException, Table not mapped

  22. 22

    Dynamic Table Name in Propel Query

  23. 23

    JDBC throws MySQL syntax Exception, despite valid query

  24. 24

    MySQL Syntax Error Exception when executing Update query

  25. 25

    How to get all table name on postgresql with Exception?

  26. 26

    Hibernate 5 "is not mapped" exception

  27. 27

    Syntax for inner Join query for 4 table

  28. 28

    Run a query on Dynamic Table Name

  29. 29

    SQL syntax error on table name

HotTag

Archive