org.hibernate.MappingException: Unknown entity:

后端 未结 3 1761
说谎
说谎 2021-01-01 23:26

I really want to understand what is going on with my code.

I have a standalone application which uses spring and Hibernate as JPA and I am trying to run the test usi

3条回答
  •  没有蜡笔的小新
    2021-01-02 00:06

    In addition to Bozho answer, if you are using spring + hibernate with annotation then in your session factory bean you can register your bean like below:

    LocalSessionFactoryBean localSessionFactoryBean = new LocalSessionFactoryBean();
    localSessionFactoryBean.setDataSource(appContext.getBean(HikariDataSource.class));
    localSessionFactoryBean.setAnnotatedClasses(
            AppUser.class, Assignment.class
    );
    

提交回复
热议问题