-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: QuerySyntaxException: TABLE is not mapped
PostPosted: Sat Mar 10, 2007 7:22 am 
Newbie

Joined: Fri Feb 23, 2007 12:42 pm
Posts: 5
Hibernate version:3.2.2.ga and JBoss 4.1 - NetBeans 5.5 - MySql 5

stack trace of any exception that occurs:
Code:
11:36:14,666DEBUG SecurityAssociation:143 - Using ThreadLocal: false
11:36:14,715DEBUG Client:514 - invoke called, but our invoker is disconnected, discarding and fetching another fresh invoker for: InvokerLocator [socket://127.0.0.2:3873/]
11:36:14,715DEBUG SocketClientInvoker:275 - connect called for: org.jboss.remoting.transport.socket.SocketClientInvoker@15d56d5
javax.ejb.EJBException: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: USR is not mapped [SELECT DISTINCT OBJECT(k) FROM USR k WHERE k.username = ?1]
...

Caused by: org.hibernate.hql.ast.QuerySyntaxException: USR is not mapped [SELECT DISTINCT OBJECT(k) FROM USR k WHERE k.username = ?1]
at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)


My EJB3 method

Code:
    public Usr getUsrByUsername(String _username) throws UsernameException {
            if(_username==null) throw new UsernameException("The username value cannot be null.");
            Usr user = (Usr)em.createQuery("SELECT DISTINCT OBJECT(k) " +
                    "FROM USR k WHERE k.username = ?1").getSingleResult();
            return user;
        }




Persistence.xml


Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" 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">
        <persistence-unit name="Users-EJBModulePU" transaction-type="RESOURCE_LOCAL">
            <!-- Jboss uses hibernate as default persistence engine
            <provider>org.hibernate.ejb.HibernatePersistence</provider> -->
            <jta-data-source>java:/MySqlDS</jta-data-source>
            <exclude-unlisted-classes>false</exclude-unlisted-classes>
            <properties>
                <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
                <!-- Show and print nice SQL on stdout -->
                <property name="hibernate.show_sql" value="true"/>
                <property name="hibernate.format_sql" value="true"/>
                <!-- Drop and create a new DB each time - Use only on development-->
                <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
            </properties>
        </persistence-unit>
    </persistence>




I'm using annotations
Code:
    @Entity
    @Table(name="USR")
    public class Usr implements java.io.Serializable {


Anyone can tell me where I'm making the mistake?
Thanks in advance

[/code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.