In Hibernate 4.0, i want to retrieve record from table using session.createQuery("from dbemployee").list();
but Hibernate is showing exception:
Hibernate Exception: org.hibernate.hql.internal.ast.QuerySyntaxException: dbemployee is not mapped [from dbemployee]**
My POJO class is Employee
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
private String empId;
private String empName;
private long empSalary;
public Employee() {
super();
}
// getters and setters
}
My table dbemployee in Oracle 11g is:
dbemployee:
EMPID varchar2(20)
EMPNAME varchar2(20)
EMPSALARY number(11);
Employee.hbm.xml is
<hibernate-mapping>
<class name="beanclass.Employee" table="dbemployee">
<id name="empId" type="java.lang.String" column="EMPID">
<generator class="assigned"></generator>
</id>
<property name="empName" column="EMPNAME" type="java.lang.String"/>
<property name="empSalary" column="EMPSALARY" type="java.lang.Long" />
</class>
</hibernate-mapping>
please help to solve this exception. Thanks in advance