如图中所示,出现此映射异常的原因是:类文件用的是注解,所以要在hibernate的配置文件中的〈mapping〉中的属性选择class,而非xml类型的resource。
此外,还要注意,在测试文件中,Configuration cfg = new AnnotationConfiguration().configure();
如图中所示,出现此映射异常的原因是:类文件用的是注解,所以要在hibernate的配置文件中的〈mapping〉中的属性选择class,而非xml类型的resource。
此外,还要注意,在测试文件中,Configuration cfg = new AnnotationConfiguration().configure();