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的异常, ...
随机推荐
- 高尔夫 之 TEE
黑色:男子职业选手蓝色:男子业余高手.女子职业选手白色:男子初学球手.老年球手.女子业余高手红色:女子选手金色:有的球场做为介于 黑Tee (职业球员)与 蓝Tee (业余高手)之间的Tee 台:有的 ...
- iOS 开发 之 编程知识点
iOS 创建和设置pch iOS 之 时间格式与字符串转换 iOS 之 二维码生成与扫描(LBXScan) iOS 之 定时器 iOS 之 通知 iOS 之 NSString 去除前后空格和回车键 i ...
- curl远程传输工具
/** * curl远程传输工具 */ public function post_curl($url,$body,$header,$type='POST'){ $ch = curl_init(); c ...
- thinkPHP 视图
一.模板的使用 a.规则 模板文件夹下[TPL]/[分组文件夹/][模板主题文件夹/]和模块名同名的文件夹[Index]/和方法名同名的文件[index].html(.tp ...
- Oracle 11gR2 RAC ohasd failed to start 解决方法
rcrCRS-4124: Oracle High Availability Services startup failed. CRS-4000: Command Start failed, or co ...
- Raphael的transform用法
Raphael的transform用法 <%@ page language="java" contentType="text/html; charset=UTF-8 ...
- Linux笔记(九) - 软件包管理
(1)软件包简介1.源码包 脚本安装包2.二进制包(rpm,系统默认包) (2)rpm包管理安装-i 安装 -v 显示详细信息 -h 显示进度--nodeps 不检测依赖性-U 升级例:安装: r ...
- Oracle 12cR1 RAC 在VMware Workstation上安装(上)—OS环境配置
Oracle 12cR1 RAC 在VMware Workstation上安装(上)-OS环境配置 1.1 整体规划部分 1.1.1 所需软件介绍 Oracle RAC不支持异构平台.在同一个集群 ...
- [TPYBoard-Micropython之会python就能做硬件 2] 利用micropython控制NOKIA 5110屏
转载请注明:@小五义 http://www.cnblogs.com/xiaowuyi 欢迎加入讨论群 64770604 一.本次实验所需器材 1.TPYboard V102板 一块 2.DS3231 ...
- Android开发知识体系总结