`
michael8335
  • 浏览: 183901 次
  • 性别: 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

    解决内存不能为read,write

    可解决内存不能为read,write .

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

    is_writable — 判断给定的文件名是否可写,该函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。 语法: bool is_writable ( string $filename ) 如果文件存在并且可写则返回 TRUE 。filename 参数可以...

    浅析is_writable的php实现

    本篇文章是对is_writable的php实现方法进行了详细的分析介绍,需要的朋友参考下

    MySQL无法重启报错Warning: World-writable config file ‘/etc/my.cnf’ is ignored的解决方法

    在关闭数据库的命令发现mysql关不了,提示Warning: World-writable config file '/etc/my.cnf' is ignored ,大概意思是权限全局可写,任何一个用户都可以写。mysql担心这种文件被其他用户恶意修改,所以忽略掉这个...

    php中判断文件空目录是否有读写权限的函数代码

    is_writable用来处理,记住 PHP 也许只能以运行 webserver 的用户名... } else { echo ‘The file is not writable’; } ?&gt; 上面的函数有一个问题就是filename 必需。规定要检查的文件 ,必须是文件啊,目录不可

    CE中文版-启点CE过NP中文.exe

    This lets you filter out code based on if it has been executed or not (Uses software breakpoints) Debugging: Added an option to chose if you wish to break on unexpected breakpoints, and if CE should ...

Global site tag (gtag.js) - Google Analytics