Error Compiling The Query Select From . Unknown Entity Type
Things LocationTech Long-Term Support PolarSys Science OpenMDM More Community Marketplace Events Planet Eclipse Newsletter Videos Participate Report a Bug Forums Mailing Lists Wiki IRC How to Contribute Working Groups Automotive Internet of Things LocationTech Long-Term Support PolarSys Science OpenMDM Toggle navigation Home Projects Forums Eclipse Community Forums Forum Search: Search Help Register Login Home Home» Eclipse Projects» EclipseLink» Unknown entity type Show: Today's Messages :: Show Polls :: Message Navigator Unknown entity type [message #478702] Thu, 06 August 2009 12:53 Serge Messages: 76Registered: July 2009 Member Hi, I have an application with added derby.jar, added eclipselink.jar and javax.persistence.jar from eclipse eclipselink-2.0.0.v20090731-r4765 installtion zip. I have entity class and some usage of this class and got different ind of message when try to use it like: Exception in thread "main" java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: Exception Description: Error compiling the query [select object(o) from DiscountCode as o]. Unknown entity type [DiscountCode]. /// Caused by: Exception [EclipseLink-8034] (Eclipse Persistence Services - 2.0.0.v20090731-r4765): org.eclipse.persistence.exceptions.JPQLException Exception Description: Error compiling the query [select object(o) from DiscountCode as o]. Unknown entity type [DiscountCode]. /// sometimes (may be with different version of eclipselink I have also message about missed "@Entity annotation" What may be wrong? //////////////////////// my persistence.xml:
This Site Careers Other all forums Forum: Object Relational Mapping JPA-Unknown entity type error when i actually have the entity in my DB ambika mullasseri Greenhorn Posts: 28 posted 6 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 https://www.eclipse.org/forums/index.php/t/152037/ 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% Vijitha Kumara Bartender Posts: 3918 10 I like... posted 6 years https://coderanch.com/t/468260/ORM/databases/JPA-Unknown-entity-type-error 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 6 years ago no it is @Entity @Table(name="employee_details") public class Employee_detail SCJP 6.0 86% Vijitha Kumara Bartender Posts: 3918 10 I like... posted 6 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 posted 6 years ago Thanks a lot .i am just trying out JPA for the first time.You really helped me out. SCJP 6.0 86% Vijitha Kumara Bartender Posts: 3918 10 I like... posted 6 years ago no problem SCJP 5 | SCWCD 5 [How to ask questions] [Twitter] Post Reply Bookmark Topic Watch Topic New Topic Similar Threads can any one help me? Recursive fetch join not recursively fetching all children About Named Queries JSP and MySql question Querying in JPA All times are in Ja
This Site Careers Other all forums Forum: Object Relational Mapping Error compiling the query. Unknown entity type [mlsUser] Marius Messerli Greenhorn Posts: 2 posted https://coderanch.com/t/538725/ORM/databases/Error-compiling-query-Unknown-entity 5 years ago Hello EJB Enthusiasts, I am running an EJB https://community.oracle.com/thread/2047284?start=0 application (swing client) for several years just fine. In the transition of upgrading to Netbeans 7 / GlassFish 3.x something has broken and I can figure out what it is. The runtime message is: Exception Description: Error compiling the query [SELECT u FROM mlsUser u error compiling WHERE u.loginName = 'joe']. Unknown entity type [mlsUser]. The application compiles, deploys, and starts without errors and it is when the applicent access the server for the first time that I get the error mentioned above. mlsUser mapps to a MySQL table "users" as follows: @Entity @Table(name="users") public class mlsUser implements Serializable {...... The persistence unit error compiling the mapps to data source "MindlinerDataSource" and the underlying connection pool pings successfully. Any help is much appreciated. Thanks, Marius James Sutherland Ranch Hand Posts: 553 posted 5 years ago Ensure the class is listed in your persistence.xml, or in the jar if using unlisted classes. Check for any errors that occurred on startup. Do other Entitys work, what is different about this one? TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance Marius Messerli Greenhorn Posts: 2 posted 5 years ago Perfect. Many (!) thanks, James. I accidentally unchecked "Include All Entity in "MindlinerServer" Module. Post Reply Bookmark Topic Watch Topic New Topic Similar Threads design decision: variation of session fassade EJB 2.1 CMP Automatic primary key issue with Speaker BureauLog inRegisterSearchSearchCancelError: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page. Please enter a title. You can not post a blank message. Please type your message and try again. More discussions in Java Programming All PlacesJavaJava EssentialsJava Programming This discussion is archived 6 Replies Latest reply on Jan 18, 2010 1:00 PM by 807580 javax.persistence.PersistenceException 807580 Jan 15, 2010 10:53 AM Hi Developers, * I did an simple JPA example with MYSQL5.0 in Eclipse, They are, Database Name : jpaexamples Database Table : student Model Class : Student.java Main Class : JPASetFirstResult.java Persistence file : persistence.xml * I am getting the following exception while running JPASetFirstResult.java, Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named jpa at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source) at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source) at com.tnq.jpa.JPASetFirstResult.main(JPASetFirstResult.java:16)Student.java package com.tnq.jpa; public class Student { private int id; public int getId() { return id; } public void setId(int id) { this.id = id; } ;.;.;.;. ;.;.;.;. .;.;.;.;JPASetFirstResult.java package com.tnq.jpa; import java.util.Iterator; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; import javax.persistence.Query; public class JPASetFirstResult { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("jpa"); EntityManager em = emf.createEntityManager(); try { EntityTransaction entr = em.getTransaction(); entr.begin(); Query query = em.createQuery("SELECT st FROM Student st"); query.setFirstResult(2); List stuList = query.getResultList(); Iterator stuIterator = stuList.iterator(); while (stuIterator.hasNext()) { Student st = (Student) stuIterator.next(); System.out.print("sname:" + st.getSname()); System.out.print("sroll:" + st.getSroll()); System.out.print("scourse:" + st.getSname()); System.out.println(); } entr.commit(); } finally { em.close(); } } }persistence.xml