Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

table not mapped error when compiling entity bean

 
karthik krishnarao
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic