提示错误是这样的:
Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Association references unmapped class: com.txsm.stuOA.vo.SchoolNumInfo
Caused by: org.hibernate.MappingException: Association references unmapped class: com.txsm.stuOA.vo.SchoolNumInfocom.txsm.stuOA.vo.SchoolNumInfo这个类是存在的.......关联的配置文件我也写了
可tomcat启动时一直报这样的错....帮帮忙吧 这个解决不了 下面的9个模块压根无法进行 每张表都有关联的
Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Association references unmapped class: com.txsm.stuOA.vo.SchoolNumInfo
Caused by: org.hibernate.MappingException: Association references unmapped class: com.txsm.stuOA.vo.SchoolNumInfocom.txsm.stuOA.vo.SchoolNumInfo这个类是存在的.......关联的配置文件我也写了
可tomcat启动时一直报这样的错....帮帮忙吧 这个解决不了 下面的9个模块压根无法进行 每张表都有关联的
你是反转的hibernate的吗?
有了又在hinbernate主配置文件里写映射了吗?
这里先总结下经验分享下吧.......不过还是谢谢上面各位的帮忙
sessionFactory
关于关联
需要修改的几个关键处 一个都不能少
1.applicationContext.xml文件
mappingResources 的<value></value>值
2.StuBasicInfo.hbm.xml文件
与之相关连的属性
3.StuBasicInfo.java文件
定义属性
构造参数的属性值增加
get set 方法增加
5.新建的*****..hbm.xml文件
name="com.txsm.stuOA.vo.*****"命名要正确
6.新建的*****.java文件
变量的定义
构造方法的名称
get set 方法的名称
我的表里有外键 然后反转的时候外键那块自动生成的是外键相关的那个类的变量
这时候我要怎么插入啊 代码如下:
private Integer schoolId;
private StuBasicInfo stuBasicInfo; //数据库表SchoolNumInfo里是 int 类型的 stuId 并且是外键而在stuBasicInfo表里stuId 是主键 stuBasicInfo
private String stuSchoolNum;
private String communistTime; 现在我要怎么做插入啊...