Hibernate: Unable to load class declared in Hibernate configuration entry

后端 未结 10 1319
野趣味
野趣味 2021-01-21 01:03

I am completely new in Hibernate and got such an stacktrace:

hql> from TracksEntity 
[2014-04-26 21:13:45] org.hibernate.MappingException: Unable to load clas         


        
10条回答
  •  无人共我
    2021-01-21 01:19

    You can do it by two methods, 2nd one definitely works.

    1. Either adding a mapping entry in hibernate.cfg.xml should make it work

    1. In your code, After you create Configuration object, Do add class like,
    Configuration config = new Configuration();
    config.addClass(com.sample.yourClass);
    

提交回复
热议问题