org.hibernate.hql.internal.ast.QuerySyntaxException: table is not mapped

后端 未结 19 1651
滥情空心
滥情空心 2020-12-04 14:59

I have example web application Hibernate 4.3.5 + Derby database 10.10.1.1+ Glassfish4.0 with IDE NetBeans 8.0Beta.

I have the next exception:

Caused          


        
相关标签:
19条回答
  • 2020-12-04 15:50

    May be this will make it more clear, and of course makes sense too.

    @Entity
    @Table(name = "users")
    
    /**
     * 
     * @author Ram Srinvasan
     * Use class name in NamedQuery
     * Use table name in NamedNativeQuery
     */
    @NamedQueries({ @NamedQuery(name = "findUserByName", query = "from User u where u.name= :name") })
    
    @NamedNativeQueries({ @NamedNativeQuery(name = "findUserByNameNativeSQL", query = "select * from users u where u.name= :name", resultClass = User.class) })
    public class User implements Principal {
    ...
    }
    
    0 讨论(0)
提交回复
热议问题