`
michael8335
  • 浏览: 187059 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Bean property 'annotatedClasses' is not writable or has an invalid setter method

阅读更多
在使用Junit测试Hibernate+Spring时,提示如下异常:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'annotatedClasses' of bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Bean property 'annotatedClasses' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
原因是,在选择Session工程类时,选择的工厂类与PO映射方式不一致,Hibernate有两个Session工厂:
1、LocalSessionFactoryBean:通过XX.hbm.xml来映射实体类
2、AnnotationSessionFactoryBean:通过注释来映射实体类
选择第一种做Session工厂时,主要通过以下方式添加PO
<mapping resource="com/hibernate/News.hbm.xml"/>
选择第二种做Session工厂时,主要通过以下方式添加PO
<property name="annotatedClasses">
<list>
<value>com.test.entity.TPerson</value>
</list>
</property>
0
0
分享到:
评论

相关推荐

    dubbo-admin 管理后台2.5.4 for JDK8

    Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property 'URIType' is not writable or has an invalid setter method. Does the parameter type ...

    支持jdk8版本dubbo-admin

    property 'URIType' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 这个问题我也在网上找了很久也没有好的解决方案,最后还是...

    org.springframework.web.servlet-3.0.1.RELEASE-A.jar

    Invalid property 'error_view' of bean class [com.demo.controller.action.AuthorAction]: Bean property 'error_view' is not writable or has an invalid setter method. Does the parameter type of the ...

    Dubbo管理控制台dubbo admin2.X for jdk8 (window,liunx)

    [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property 'URIType' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of ...

    proxool jar包

    Invalid property 'houseKeepingSleepTime' of bean class [org.logicalcobwebs.proxool.ProxoolDataSource]: Bean property 'houseKeepingSleepTime' is not writable or has an invalid setter method. Does the ...

    dubbo-admin-2.5.8.war(编译环境JDK8)

    dubbo-admin管理控制台安装... Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property 'URIType' is not writable or has an invalid setter method.

    dubbo-admin jdk1.8

    dubbo-admin 在jdk1.8 环境下会出现Bean property 'URIType' is not writable or has an invalid setter,此版本通过替换citris,spring的低版本解决了这个问题

    org.springframework.transaction-3.1.2.RELEASE.zip

    org.springframework.beans....: Bean property 'transactionManagerBeanName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

    dubbo_admin-2.54.war和dubbo_admin_2.54forJDK8

    property 'URIType' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 把其中的spring2的系列JAR包换成了spring3的,就可以在JDK8...

    精通pl/sql part2

    精通pl/sql part2

    Storage Not Writable(解决方案).md

    Storage Not Writable(解决方案).md

    Directory Not Writable(解决方案).md

    Directory Not Writable(解决方案).md

    Backup Directory Not Writable(解决方案).md

    Backup Directory Not Writable(解决方案).md

    Cache Directory Not Writable(解决方案).md

    Cache Directory Not Writable(解决方案).md

    浅析is_writable的php实现

    在某些情况下,内置的is_writable()函数可能无法正确地判断文件或目录的可写状态,比如在检查远程文件系统或某些特殊权限设置的情况下。这时,我们就可能需要自定义一个函数来模拟is_writable()的功能。 在给定的...

    解决内存不能为read,write

    标题 "解决内存不能为read,write" 描述的是一个常见的计算机错误提示,通常在Windows操作系统中出现。这个错误表示程序在尝试访问内存时遇到了问题,可能是由于软件bug、硬件故障或者系统兼容性问题导致的。...

    php is_writable判断文件是否可写实例代码

    `is_writable()`会返回一个布尔值,如果文件存在且可写,那么返回`TRUE`,反之则返回`FALSE`。 ### 函数定义和语法 ```php bool is_writable ( string $filename ) ``` - `$filename`: 需要检查其可写性的文件或...

Global site tag (gtag.js) - Google Analytics