这要么就是applicationcontext.xml的bean属性配错了,要么就是*.hbm.xml映射文件属性配错了,下面就是我遇到的问题
Error creating bean with name 'transactionManager' defined in file [E:\myproject\.metadata\.me_tcat\webapps\Verycd-Movie\WEB-INF\classes\applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [E:\myproject\.metadata\.me_tcat\webapps\Verycd-Movie\WEB-INF\classes\applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: Integer, at table: VERYCD_COMMENT, for columns: [org.hibernate.mapping.Column(COMMENT_ID)]
很明显就是comment_id的类型不明确,所以我先检查实体类属性和映射文件对应列是否类型一致,发现我的是一致的,经过很久的排查,竟然发现是映射文件列类型是Integer,表面上没什么错,然而当我试着改成java.lang.Integer后,错误就消失了,我也是有点想骂娘。。。下面是截图