org.hibernate.MappingException: Unknown entity: annotations.Users

前端 未结 19 1629
情歌与酒
情歌与酒 2020-12-01 07:11

Consider the hierarchy :

\"enter

And the following classes and xml :

19条回答
  •  误落风尘
    2020-12-01 07:56

    In my case it resolves by adding configuration.addAnnotatedClass(com.myApp.model.Example.class); after Configuration configuration = new Configuration().configure(HibernateUtil.class.getResource("/hibernate.cfg.xml")); in hibernateUtill class. It Read a mapping from the class annotation metadata . Read more about addAnnotatedClass() from here.

提交回复
热议问题