- 
        1. Re: NamedQuery problem: TABLE is not mappedwolfgangknauf Nov 24, 2009 7:07 AM (in response to pi4630)Hi, 
 in your named query, you have to use the name of the entity bean class, not the table name.
 So it should be "SELECT a FROM Artikel a ORDER BY a.Artnr".
 If the property has getter/setter "getArtnr"/"setArtnr", it has to be named "Artnr" in the query.
 Hope this helps
 Wolfgang
- 
        2. Re: NamedQuery problem: TABLE is not mappedpi4630 Nov 24, 2009 7:49 AM (in response to pi4630)Wolfgang, thanks for caring, thumbs up! The book I'm studying does not mention case sensitivity, and I thought the statement would be table related, not class related. 
 So thank you very much, because after changing the case, it worked.
 There's one thing: I have indeed a artnr field and public getters and settes which render it Artnr (getArtnr and setArtnr). I tried your hint first, i.e.SELECT a FROM Artikel a ORDER BY a.Artnr but this yields an exception when deploying:ERROR [SessionFactoryImpl] Error in named query: findAllArtikel org.hibernate.QueryException: could not resolve property: Artnr of: ser.kap08.Artikel [SELECT a FROM ser.kap08.Artikel a ORDER BY a.Artnr] 
 If I try with the field case instead, i.e.SELECT a FROM ser.kap08.Artikel a ORDER BY a.artnr 
 it's fine.
- 
        3. Re: NamedQuery problem: TABLE is not mappedwolfgangknauf Nov 25, 2009 8:40 AM (in response to pi4630)I'm sorry, I was wrong with the casing of the property. You are right, it has to be lower case. 
 Getter/Setter "getArtnr"/"setArtnr" indeed form a property "artnr".
 Wolfgang
- 
        4. Re: NamedQuery problem: TABLE is not mappedpi4630 Nov 25, 2009 9:47 AM (in response to pi4630)Thank *you* :)! 
- 
        5. Re: NamedQuery problem: TABLE is not mappeddanwin Aug 25, 2010 12:31 PM (in response to pi4630)I am getting the "TABLE is not mapped" exception when I don't map the table explicitily in my persistence.xml. Obviously the autodetection property doesn't work. <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"> <persistence-unit name="Employee-Details"> <jta-data-source>java:/jdbc/employee</jta-data-source> <properties> <!-- for detecting the Mapped Files --> <property name="hibernate.archive.autodetection" value="class" /> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="true" /> </properties> </persistence-unit> </persistence> When I add <class>employee.EmployeeEntity</class> I don't have any problem. But I would like to generate the tables and entities. And therefore I don't want to add configuration everytime. Can anyone help? 
- 
        6. Re: NamedQuery problem: TABLE is not mappedwolfgangknauf Aug 26, 2010 7:00 AM (in response to danwin)Hi David, let's continue this in a new thread, as it might not be related to the original question. Actually, I don't get the problem ;-). So you have autogenerated classes, which contain no annotations, but you want to let the server detect them as EJBs? I think a hibernate property will not help, you need to do an EJB way. If annotations are not possible, declare them in ejb-jar.xml. Hope this helps Wolfgang 
- 
        7. Re: NamedQuery problem: TABLE is not mappeddanwin Aug 26, 2010 11:03 AM (in response to wolfgangknauf)Sorry for the confusing loop. At my current project I don't generate code but I get the "TABLE is not mapped" message if I don't add the line <class>employee.EmployeeEntity</class> to my persistence.xml. My question is, why the table don't get mapped although I use annotations package employee; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "employee") public class EmployeeEntity { @Id private int empNo; private String empName; private String ibu; private String designation;and autodetection: <property name="hibernate.archive.autodetection" value="class" /> ??? Thanks, Daniel 
- 
        8. Re: NamedQuery problem: TABLE is not mappedjaikiran Aug 26, 2010 11:39 AM (in response to danwin)Looking at the hibernate code which parses this configuration, I think there might be a bug in there. I'm not completely sure because I just quickly glanced over the code without going into too much details. Can you quickly try this: <property name="hibernate.archive.autodetection" value="class,hbm" /> or even this: <property name="hibernate.archive.autodetection" value="class," /> (Note the "," after "class") Let us know how it goes. 
- 
        9. Re: NamedQuery problem: TABLE is not mappeddanwin Aug 27, 2010 4:27 AM (in response to jaikiran)I've tried both, but I still get: 10:25:16,819 INFO [STDOUT] org.hibernate.hql.ast.QuerySyntaxException: EmployeeEntity is not mapped [select e from EmployeeEntity e] 
- 
        10. Re: NamedQuery problem: TABLE is not mappedwolfgangknauf Aug 27, 2010 4:29 PM (in response to danwin)Hi Daniel, actually, it should not be necessary to trouble with hibernate config, it should detect Entity Beans itself. Where do you declare and use your query? I don't see a "@NamedQuery" annotation on the entity (where they have to be placed, other locations as session beans don't work as far as I remember). Do you call the query directly against the entity manager? Best regards Wolfgang 
- 
        11. Re: NamedQuery problem: TABLE is not mappeddanwin Aug 27, 2010 6:16 PM (in response to wolfgangknauf)Hello Wolfgang, yes I am using an EntityManager instance to create a query: EntityManagerFactory emf = Persistence.createEntityManagerFactory("Employee-Details"); em = emf.createEntityManager(); EntityTransaction et = em.getTransaction(); et.begin(); Query query = em.createQuery("select e from EmployeeEntity e"); empList = query.getResultList();Does it make a difference to use the @NamedQuery annotation? Kind regards, Daniel 
- 
        12. Re: NamedQuery problem: TABLE is not mappedwolfgangknauf Aug 28, 2010 11:21 AM (in response to danwin)Hi, basically, your code should work I think. I have one question left: where is your code? Is it in a web app? Or in a session bean in the EJB jar? Or in an application client? I assume that you did not place the code fragment in the EJB jar file, and maybe this is the reason why the entity name cannot be resolved. Best regards Wolfgang 
- 
        13. Re: NamedQuery problem: TABLE is not mappeddanwin Aug 29, 2010 4:10 AM (in response to wolfgangknauf)Hi Wolfgang, I am deploying a war file .. src employee EmployeeBean.java EmployeeEntity.java EmployeeService.java META-INF persistence.xml WebContent META-INF (contains only empty MANIFEST) WEB-INF lib (some jars) faces-config.xml web.xml EmployeeHome.jsp Home.jsp Daniel 
- 
        14. Re: NamedQuery problem: TABLE is not mappedwolfgangknauf Aug 29, 2010 4:13 PM (in response to danwin)So you have a JavaEE6 project? In previous versions, Entities in a web module were not possible, they are a new feature of JavaEE6. Maybe there is a problem with hibernate handling them. Best regards Wolfgang 
 
     
     
    