File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes table not mapped error when compiling entity bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "table not mapped error when compiling entity bean" Watch "table not mapped error when compiling entity bean" New topic

table not mapped error when compiling entity bean

karthik krishnarao

Joined: May 26, 2011
Posts: 2
I am getting the following error when trying to compile my code.

org.hibernate.hql.ast.QuerySyntaxException: Customer is not mapped [SELECT customer_number FROM Customer cusNum WHERE customer_Number = :customerNumber ]

here is my class.

@Table(name = "CUSTOMER", uniqueConstraints = {})
@NamedQueries( { @NamedQuery(name = CustNumbInUse.CUSTOMER, query = "SELECT cusNumIU "
+ "FROM Customer cusNumIU "
+ "WHERE customerNumber = :customerNumber ") })
public class Customer implements Serializable {

private static final long serialVersionUID = 1L;
public static final String FIND_BY_CUST_NUMB = "findByCustomerNumber";

private String customerNumber;

/** default constructor */
public Customer() {

/** full constructor */
public Customer(String customerNumber) {
this.customerNumber = customerNumber;


@Column(name = "CUSTOMER_NUMBER", unique = true, nullable = false, insertable = true, updatable = true, length = 24)
public String getCustomerNumber() {
return this.customerNumber;

public void setCustomerNumber(String customerNumber) {
this.customerNumber = customerNumber;


persistence .xml

<persistence-unit name="CUST_PU" transaction-type="JTA">
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.show_sql" value="true"/>

I have tried using the full qualified name of the class in the query but to no use. i still get the same error.

Your help on this is much appreciated.
I agree. Here's the link:
subject: table not mapped error when compiling entity bean
It's not a secret anymore!