org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.entity.annotations.House.district in
org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.entity.annotations.House.district in com.entity.annotations.Street.houses
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:578)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:543)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1177)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:329)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1333)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at com.test.Demo04.saveHouseInfo(Demo04.java:53)
at com.test.Demo04.main(Demo04.java:18)
Exception in thread "main" java.lang.NullPointerException
at com.test.Demo04.saveHouseInfo(Demo04.java:74)
at com.test.Demo04.main(Demo04.java:18)
House.java
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_house")
@SequenceGenerator(name = "seq_house", sequenceName = "seq_house_id", allocationSize = 100, initialValue = 61)
private int id;
@Column(name = "title")
private String title; // 标题
@Column(name = "description")
private String description; // 描述
@Column(name = "price")
private int price; // 出租价格
@Column(name = "pubdate")
private Date pubdate; // 发布时间
@Column(name = "floorage")
private int floorage; // 面积
@Column(name = "contact")
private String contact; // 联系人
@Column(name = "user_id")
private int user_id; // 用户编号
@Column(name = "type_id")
private int type_id; // 类型编号
// private int street_id; // 街道编号
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "street_id")
private Street streets;
Street.java
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_street")
@SequenceGenerator(name = "seq_street", sequenceName = "seq_street_id", allocationSize = 100, initialValue = 11)
private int id;
@Column(name = "name")
private String name;
@OneToMany(mappedBy = "district", cascade = { CascadeType.ALL })
private List<House> houses = new ArrayList<House>();
错误的原因是: @OneToMany(mappedBy = "district", cascade = { CascadeType.ALL }) 这里面的 mappedBy中“district”写错了映射的对象
org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.entity.annotations.House.district in的更多相关文章
- org.hibernate.AnnotationException: mappedBy reference an unknown target entity property
org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: xxxxxxx 原因是 ...
- mappedBy reference an unknown target entity property解决方法
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error ...
- org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.demo.pojo.IdCard
转自:https://blog.csdn.net/zheng0518/article/details/11029733 TestStudent.testSchemaExporttestSchemaEx ...
- Hibernate之mappedBy
Hibernate之mappedBy 摘要: 一.mappedBy单向关系不需要设置该属性,双向关系必须设置,避免双方都建立外键字段 数据库中1对多的关系,关联关系总是被多方维护的即外键建在多方,我们 ...
- JPA error org.hibernate.AnnotationException: No identifier specified for entity
错误:org.hibernate.AnnotationException: No identifier specified for entity 原因:JPA所使用的Entity需要标注@Id,在引用 ...
- 报错Caused by: org.hibernate.AnnotationException: No identifier specified for entity:
Caused by: org.hibernate.AnnotationException: No identifier specified for entity:. 原因: 1.没有给实体类ID 解决 ...
- Springboot- Caused by: org.hibernate.AnnotationException: No identifier specified for entity:
错误与异常: Caused by: org.hibernate.AnnotationException: No identifier specified for entity: 原因:引用了不对的包, ...
- org.hibernate.AnnotationException: No identifier specified for entity: com.example1.demo1.Entity.User错误
最近在公司带人,他们问我的问题在这里也顺便总结下. 此项目为SpringDataJpa项目. 出现的错误如下: Caused by: org.hibernate.AnnotationException ...
- org.hibernate.AnnotationException: No identifier specified for entity:
使用hibernate的e-r映射pojo类的时候遇到org.hibernate.AnnotationException: No identifier specified for entity的异常, ...
随机推荐
- hdu-3790-最短路径问题(dijkstra算法)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3790 这题cin会超时i 关于解决cin超时的问题 在main函数开头加上 ios::sync_wit ...
- Bootstrap入门(二十七)JS插件4:标签页
Bootstrap入门(二十七)JS插件4:标签页 标签页的切换可以带动内容的变化 首先我们引入CSS文件 <link href="bootstrap.min.css" re ...
- 导入android工程没有R文件的解决办法
第一种: 千万不要重启Eclipse.也不自己创建R.java 类文件! 右击你的工程(项目)——>Android Tools——>Fix Project Properties ...
- OpenCV 3.2正式发布啦
2016年12月23号OpenCV社区宣布了OpenCV3.2版本正式发布,这个是在OpenCV3.1版本发布一年以后再次升级.在3.2版本中有总数超过数千个的改进与修正,是OpenCV3.x系列中最 ...
- 使用SpringMvc调用POI jar导出excel的源码
@RequestMapping(value = "/result/export") public String export(ResultIn in,HttpServletRequ ...
- 支付宝ios支付请求Java服务端签名报的一个错(ALI40247) 原创
今天做app的支付宝支付,遇到些问题,以前做支付宝支付签名都是直接在客户端App进行,今天下了最新版本ios的支付宝支付demo,运行demo时底部有红色的显眼字体,告知用户签名必须在服务端进行... ...
- WPF DEV CellTemplateSelector(一个正确使用DevExpress CellTemplateSelector的Demo)
说明 我在项目中根据需求需要用到WPF Dev CellTemplateSelector时,遇到不少坑.曾一度想要放弃使用模板转换器,但又心有不甘,终于在不断努力下,达到了需求的要求.所以写下来和大家 ...
- 使用python制作ArcGIS插件(4)界面交互
使用python制作ArcGIS插件(4)界面交互 by 李远祥 插件界面部分,除了一开始在设计器中设计的这些界面元素之外,还可以与操作系统进行一些输入输出的交互,这部分的实现全部在pythonadd ...
- 浅谈时间复杂度- 算法衡量标准Big O
写在前面: 今天有一场考试,考到了Big-O的知识点,考到了一道原题,原题的答案我记住了,但实际题目有一些改动导致答案有所改动,为此作者决定重新整理一下复杂度相关知识点 Efficiency and ...
- 矢量切片(Vector tile)
说明:本月的主要工作都是围绕制作矢量切片这一个核心问题进行的,所以2月的主题就以这个问题为主,目前分支出来的一些内容主要包括了TMS(Tile map service),OpenLayers3中的Pr ...