Hibernate映射文件問題nested exception is org.hibernate.PropertyAccessException:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="packagesToScan"> <list> <value>com.test.model</value> </list> </property> <property name="hibernateProperties"> <value> hibernate.dialect=org.hibernate.dialect.SQLServerDialect hibernate.show_sql=true hibernate.hbm2ddl.auto=update </value> </property> </bean在這段配置中應該加orm 因為異常提示找不到關系映射文件可修改成 <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mappingResources"> <list> <value>com/test/model/User.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <value> hibernate.dialect=org.hibernate.dialect.SQLServerDialect hibernate.show_sql=true hibernate.hbm2ddl.auto=update </value> </property> </bean