org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.demo.pojo.IdCard
转自:https://blog.csdn.net/zheng0518/article/details/11029733
TestStudent.testSchemaExport
testSchemaExport(com.demo.pojo.dxwj.TestStudent)
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.demo.pojo.dxwj.Students.cardId references an unknown entity: com.demo.pojo.dxwj.IdCard
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:107)
at org.hibernate.cfg.Configuration.processEndOfQueue(Configuration.java:1580)
at org.hibernate.cfg.Configuration.processFkSecondPassInOrder(Configuration.java:1503)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1419)
at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:1002)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:130)
at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:92)
at com.demo.pojo.dxwj.TestStudent.testSchemaExport(TestStudent.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
原因有二:
(1) 被引用的类的class上没添@Entity注解
(2)没有添sessionFactory的annotatedClasses属性列表中去或者是配置文件中没有添加<mapping-class>
---------------------
作者:onyas
来源:CSDN
原文:https://blog.csdn.net/zheng0518/article/details/11029733?utm_source=copy
版权声明:本文为博主原创文章,转载请附上博文链接!
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.demo.pojo.IdCard的更多相关文章
- 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. ...
- 020 <one-to-one>、<many-to-one>单端关联上的lazy(懒加载)属性
<one-to-one>.<many-to-one>单端关联上,可以取值:false/proxy/noproxy(false/代理/不代理) 实例一:所有lazy属性默认(支持 ...
- 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的异常, ...
- org.hibernate.AnnotationException: mappedBy reference an unknown target entity property
org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: xxxxxxx 原因是 ...
- hibernate 一对一(One-to-One)
一对一(one-to-one)实例(Person-IdCard) 一对一的关系在数据库中表示为主外关系.例如.人和身份证的关系.每个人都对应一个身份证号.我们应该两个表.一个是关于人信息的表(Pers ...
随机推荐
- JS——i++与++i
先赋值后自增: var i = 0; var n1 = i++; alert(i);//返回1 alert(n1);//返回0 先自增后赋值: var i = 0; var n1 = ++i; ale ...
- java设计模式02观察者模式
观察者模式定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象.这个主题对象在状态上发生变化时,会通知所有观察者对象,使它们能够自动更新自己. 这里主要讲一下学习内置观察者的记录,在JA ...
- HDU_2212_水
DFS Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submiss ...
- 宏基因组扩增子图表解读2散点图:组间整体差异分析(Beta多样性)
散点图 数据点在直角坐标系平面上的分布图.在宏基因组领域,散点图常用于展示样品组间的Beta多样性,常用的分析方法有主成分分析(PCA),主坐标轴分析(PCoA/MDS)和限制条件的主坐标轴分析(CP ...
- 04 学习java养成良好的写作习惯
1, 驼峰命名法 首字母大写 2, 写的时候大小中括号都补全,不忘记分号 不要都放在一行上 3, 缩进对其,tab键 4, 严格要求自己,养成良好的写作风格 5, javadoc可以将文档注释,直接生 ...
- Python 内置函数 day4
import random s = 'abczfg' st= {3,4,9,1,8} print(dir(random))#打印模块内的方法,输出模块/变量可以调用的方法 print(dir(s))# ...
- Django - 数据获取
Django - 数据获取 1.radio值获取 2.checkbox获取 3.select 获取 select 获取值,需要根据前端multiple来获取,get or getlist; 4.上传文 ...
- oracle的递归运算(树运算) 无限树形
oracle的递归运算(树运算)start with org_id ='1'connect by prior parent_id=son_id 1.前言 oracle的递归运算,在我们web页面的 ...
- 原始js表单文本框初始化获取焦点和选中
发现: 1 使用dom对象.focus() 放在 window.onload 时可以 让这个DOM对象获取焦点. 2 使用DOM对象.select() 可以选中文本框中的文字. 3 不要加上on , ...
- Getmemory问题
题目一: [cpp] view plaincopy void GetMemory( char *p ) { p = ( ); } void Test( void ) { char *str = NUL ...