I get this error when I run Tomcat:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is
org.hibernate.MappingNotFoundException: resource:
com/itheima/elec/domain/ElecText.hbm.xml not found
But it is really exists in my project:
And in my Hibernate configuration is like below:
<session-factory>
...
<mapping resource="com/itheima/elec/domain/ElecText.hbm.xml"/>
<mapping resource="com/itheima/elec/domain/ElecCommonMsg.hbm.xml"/>
</session-factory>
I don't know where the issue is, can some friend help me?
Please use @Annotations for the classes inside your domain folder,then you no need to use hbm.xml files. After that in hibernate.cfg.xml file use ''