mappedBy reference an unknown target entity property解决方法
2014-06-17 21:44
501 查看
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'articleDaoImpl': Injection of resource methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.wangzhe.model.Keyword.Articles in com.wangzhe.model.Article.keywords
上面是错误的关键部分
错误原因:在one-to-many注解配置: @OneToMany (mappedBy = "Articles"),mappedBy指向的是要关联的属性,而不是要关联的类,
如果这样配置,hibernate则会找com.wangzhe.model.Keyword类下面的Articles 属性。但实际上没有这个属性,就会报上面的异常
方法:指定到实际关联的属性:即:@OneToMany (mappedBy = "articles ")
上面是错误的关键部分
错误原因:在one-to-many注解配置: @OneToMany (mappedBy = "Articles"),mappedBy指向的是要关联的属性,而不是要关联的类,
如果这样配置,hibernate则会找com.wangzhe.model.Keyword类下面的Articles 属性。但实际上没有这个属性,就会报上面的异常
方法:指定到实际关联的属性:即:@OneToMany (mappedBy = "articles ")
相关文章推荐
- mappedBy reference an unknown target entity property解决方法
- mappedBy reference an unknown target entity property
- mappedBy reference an unknown target entity property: com.sq.entity.Address.tt_user in com.sq.entit
- org.hibernate.AnnotationException: mappedBy reference an unknown target entity property
- Eclipse上JPA报错:Target Entity is not a entity 和the "mapped by" attribute has an invalid mapping type
- An entity object cannot be referenced by multiple instances of IEntityChangeTracker错误解决
- php5.3 中显示Deprecated: Assigning the return value of new by reference is deprecated in 的解决方法
- ognl.OgnlException: target is null for setProperty(null, "offset", [Ljava.lang.String;@1667f3c) 解决方法
- (转)An entity object cannot be referenced by multiple instances of IEntityChangeTracker.
- eclipse下 Failed to find an AVD compatible with target 的解决方法
- Warning: Call-time pass-by-reference has been deprecated解决方法
- php5.3 中显示Deprecated: Assigning the return value of new by reference is deprecated in 的解决方法
- VS2010 出现错误提示“Error Creating Control - Object reference not set to an instance of an objec” 的解决方法
- “Warning: Call-time pass-by-reference has been deprecated in”解决方法
- eclipse下 Failed to find an AVD compatible with target 的解决方法
- The reference to entity "password" must end with the ';' delimiter.的原因跟解决方法
- 设置ip转发提示iptables: No chain/target/match by that name错误的解决方法
- org.hibernate.MappingException: Unknown entity 解决方法
- 解决安装vmware workstation出现this port is in use by anohter program的方法
- The reference to entity "password" must end with the ';' delimiter.的原因跟解决方法