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

后端 未结 19 1747
滥情空心
滥情空心 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:48

    None of the other solution worked for me.

    Even if I don't think its the best practice, I Had to add it into the code like this

    configuration.addAnnotatedClass(com.myOrg.entities.Person.class);

    here

    public static SessionFactory getSessionFactory() {
        Configuration configuration = new Configuration().configure();
    
        configuration.addAnnotatedClass(com.myOrg.entities.Person.class);
    
        StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder()
                .applySettings(configuration.getProperties());
        SessionFactory sessionFactory = configuration.buildSessionFactory(builder.build());
        return sessionFactory;
    }
    

提交回复
热议问题