MyEclipse生成的Hibernate一对一配置问题
来源:互联网 发布:react router js跳转 编辑:程序博客网 时间:2024/05/21 11:10
myeclipse的hibernate反转工具生成的一对一映射配置无法使用,在项目启动时就报错,
错误信息如下:
org.hibernate.AnnotationException: Unknown mappedBy in: db.Produce.qualification, referenced property unknown: db.Qualification.produce at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:158) at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1591) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1366) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1731) at db.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:48)
生成的
主表类Produce的关键代码如下:
@OneToOne(fetch = FetchType.LAZY, mappedBy = "produce") public Qualification getQualification() { return this.qualification; }
外表类Qualification的关键代码如下:
@OneToOne(fetch = FetchType.LAZY, mappedBy = "qualification") @JoinColumn(name = "produce_id") public Produce getProduce() { return this.produce; }
解决办法:
将外表类Qualification的配置改为:
@OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "produce_id") public Produce getProduce() { return this.produce; }
即去掉mappedBy参数,切记不能自以为是的将外表类Qualification的配置mappedBy = “qualification”改成mappedBy = “produce”,如此改动,仍然会报错。
0 0
- MyEclipse生成的Hibernate一对一配置问题
- Hibernate中的一对一映射文件的配置
- MyEclipse的Hibernate配置
- hibernate 一对一配置
- HIBERNATE一对一配置
- Hibernate 一对一关系配置
- Hibernate框架由myeclipse自动生成遇到的问题
- 在myeclipse下配置hibernate c3p0连接池的问题
- Hibernate的一对一关系
- hibernate 有外键的一对一
- Hibernate的一对一映射
- Myeclipse下的hibernate配置
- Hibernate一对一映射配置详解
- 【Hibernate 3】一对一映射配置
- hibernate注解配置一对一映射
- hibernate一对一、一对多、多对多的配置方法
- myeclipse的配置问题
- myeclipse自动生成hibernate的xml文件
- Logstash学习4_Logstash如何将操作日志中的字符串类型的时间转化成@timestamp
- spark视频课程下载链接
- 可拖动的listview
- Linux下nginx安装笔记
- POJ-1050-To the Max-dp
- MyEclipse生成的Hibernate一对一配置问题
- 【iOS学习笔记 15-11-10】Objective-C中根据函数名调用函数
- sicily 1375 Balanced lineup
- AOP 实现原理
- ant 使用指南
- mysql 获取当月de日期信息
- 什么是串并口硬盘 串口与并口硬盘的区别
- Matlab计算机视觉/图像处理工具箱推荐
- Liferay Portal 学习笔记(一),介绍