mappedBy reference an unknown target entity property

  • Post author:
  • Post category:其他


mappedBy reference an unknown target entity property: com.chinacache.oss.entity.resource.ChannelSmsUpStreamToIp.channelSmsUpStream in com.chinacache.oss.entity.resource.ChannelSmsUpStream.channelSmsUpStreamToIps



at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)



at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)



at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)



at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)



at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)



at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)



at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)



at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:1094)



at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1044)



at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)



… 80 more

如题: mappedBy  一个未知的实体属性channelSmsUpStream ,导致的错误,然而我在channelSmsUpStreamToIps里面已经定义了channelSmsUpStream 属性。最后经过三小时的排查 是因为getChannelSmsUpStream()方法多了一个l,即 getChannelSmsUpStream

l

(), 属性channelSmsUpStream 的get方法写错导致无法找到对应的属性;

ps. 查到网上,出现这个问题的另一个原因:mappedBy是关联实体的某个属性(如channelSmsUpStream ),但是写成了这个属性对应的变量类型(如ChannelSmsUpStream )



版权声明:本文为u011587399原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。