AnnotationConfiguration和Configuration混用时出错

来源:互联网 发布:office for mac多少钱 编辑:程序博客网 时间:2024/05/22 14:47

Teacher类:

 

Student类:

 

用JUnit测试:

TeacherTest:

 

StudentTest:

 

hibernate.cfg.xml:

 

测试StudentTest时,会出现new Configuration()得不到值,出现空指针

改为AnnotationConfiguration()即刻解决问题

 

 

原创粉丝点击