[jboss-user] [EJB 3.0 Users] - NamedQuery problem: TABLE is not mapped

pi4630 do-not-reply at jboss.com
Tue Nov 24 06:11:58 EST 2009


Hi,

I'm using a NamedQuery in my Artikel entity bean, but mapping by annotation doesn't take place.
The bean starts like this:


  | @Entity
  | @Table(name="ARTIKEL")
  | @NamedQuery(name="findAllArtikel", query ="SELECT a FROM ARTIKEL a ORDER BY a.artnr")
  | public class Artikel implements java.io.Serializable {
  | 

When I start up my JBoss, I get the follwoing exception:


  | ERROR [SessionFactoryImpl] Error in named query: findAllArtikel
  | org.hibernate.hql.ast.QuerySyntaxException: ARTIKEL is not mapped [SELECT a FROM ARTIKEL a ORDER BY a.artnr]
  | 

My persistence.xml looks like this

  | <?xml version="1.0" encoding="UTF-8"?>
  | <persistence xmlns="http://java.sun.com/xml/ns/persistence"
  | 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  | 	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
  | 		http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
  | 	version="1.0">
  | 	<persistence-unit name="JavaEE">
  | 		<jta-data-source>java:DefaultDS</jta-data-source>
  | 		<properties>
  | 		<property name="hibernate.archive.autodetection" value="class"/>
  | 		</properties>
  | 	</persistence-unit>
  | </persistence>
  | 
Originally, the persistence.xml was without the properites section, a thing I ran into looking around in Java forums. I am using HSQL db. There's obviously something missing fro hibernate, but I can't say what to put where.

I am using Java SDK 1.5 along with Jboss 4.0.4 GA.


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4267262#4267262

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4267262



More information about the jboss-user mailing list