用Junit测试出现映射注解异常



如图中所示,出现此映射异常的原因是:类文件用的是注解,所以要在hibernate的配置文件中的〈mapping〉中的属性选择class,而非xml类型的resource。

此外,还要注意,在测试文件中,Configuration cfg = new AnnotationConfiguration().configure();

猜你喜欢

转载自blog.csdn.net/wang645372816/article/details/43801971