hibernate 配置文件有问题吗?哪里错了呢

来源:百度知道 编辑:UC知道 时间:2024/06/19 15:16:38
18:55:48,376 INFO Environment:514 - Hibernate 3.2.6
18:55:48,386 INFO Environment:547 - hibernate.properties not found
18:55:48,396 INFO Environment:681 - Bytecode provider name : cglib
18:55:48,406 INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling
18:55:48,527 INFO Configuration:1432 - configuring from resource: /hibernate.cfg.xml
18:55:48,527 INFO Configuration:1409 - Configuration resource: /hibernate.cfg.xml
18:55:49,037 INFO Configuration:559 - Reading mappings from resource : com/fang/hibernate/User.hbm.xml
18:55:49,418 INFO HbmBinder:300 - Mapping class: com.fang.hibernate.User -> User
Exception in thread "main" org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/fang/hibernate/User.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:575)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1593)
at org.hib

注意这个异常“Caused by: org.hibernate.PropertyNotFoundException: field [password] not found on com.fang.hibernate.User ”的关键信息,

指的是你自定义的类com.fang.hibernate.User中没有password名称的字段属性,注意区分大小写及JavaBean的规范。com.fang.hibernate.User中应该有setPassword和getPassword。