posted 8 years ago
i have a table employee_details
i tried to fire the query
Query query = em.createQuery(queryString);
where queryString = select emp.Emp_Id from employee_details emp
exception in thread "main" java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1067)
at com.myoffice.hr.dao.Utils.Connection_Util.doSelection(Connection_Util.java:30)
at com.myoffice.hr.dao.Access_Employee_Detail.getEmployeeByName(Access_Employee_Detail.java:36)
at com.myoffice.hr.dao.Access_Employee_Detail.main(Access_Employee_Detail.java:44)
Caused by: Exception [EclipseLink-8034] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [select emp.Emp_Id from employee_details emp]. Unknown entity type [employee_details].
but when i try to insert using em.persist(obj);
the data is getting inserted,which means the connection is correct.
please help me regarding this.
i tried to fire the query
Query query = em.createQuery(queryString);
where queryString = select emp.Emp_Id from employee_details emp
exception in thread "main" java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1067)
at com.myoffice.hr.dao.Utils.Connection_Util.doSelection(Connection_Util.java:30)
at com.myoffice.hr.dao.Access_Employee_Detail.getEmployeeByName(Access_Employee_Detail.java:36)
at com.myoffice.hr.dao.Access_Employee_Detail.main(Access_Employee_Detail.java:44)
Caused by: Exception [EclipseLink-8034] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [select emp.Emp_Id from employee_details emp]. Unknown entity type [employee_details].
but when i try to insert using em.persist(obj);
the data is getting inserted,which means the connection is correct.
please help me regarding this.
SCJP 6.0 86%
posted 8 years ago
Is your domain object (POJO) you are trying to query against named "employee_details" ?
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
ambika mullasseri
Greenhorn
Posts: 28
posted 8 years ago
Then you should use "Employee_detail" in your query.
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
ambika mullasseri
Greenhorn
Posts: 28

It is sorta covered in the JavaRanch Style Guide. |