Hibernate: Unable to load class declared in Hibernate configuration entry

后端 未结 10 1313
野趣味
野趣味 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:08

    I had a similar problem when the mapping file wouldn´t load correctly. The answer to this problem seems to be that we need to use the correct import statements in our Model classes.

    Changing the import to import javax.persistence.Entity instead of using the one from hibernate package ( ie org.hibernate.annotations.Entity), fixed the issue in my case.

    This issue is a real pain , and I spent more than 1/2 day looking at all corners, when a simple import fixed the issue.

    Hope this helps.

提交回复
热议问题