aspose file tools*
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
Author

table not mapped error when compiling entity bean

karthik krishnarao
Greenhorn

Joined: May 26, 2011
Posts: 2
hi,
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.

@Entity
@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;

}

@Id
@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">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/CUST_DS</jta-data-source>
<class>com.cgi.bellinternetservices.customerreservation.Customer</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.show_sql" value="true"/>
</properties>
</persistence-unit>


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.
 
 
subject: table not mapped error when compiling entity bean