博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.demo.pojo.IdCard
阅读量:6941 次
发布时间:2019-06-27

本文共 2574 字,大约阅读时间需要 8 分钟。

转自: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
版权声明:本文为博主原创文章,转载请附上博文链接!

转载于:https://www.cnblogs.com/sharpest/p/9789712.html

你可能感兴趣的文章
kiiti分割的数据及其处理
查看>>
如何学习Python的一些总结
查看>>
Jenkins下载安装
查看>>
Spark:JavaRDD 转化为 Dataset<Row>的两种方案
查看>>
Chapter 5 Blood Type——8
查看>>
react-native 启动页(react-native-splash-screen)
查看>>
wpf 触摸屏 button 背景为null的 问题
查看>>
C# Task用法
查看>>
Javascript的console.log()用法
查看>>
node-packer
查看>>
FIR滤波原理及verilog设计
查看>>
Android Studio主题设置、颜色背景配置
查看>>
【转】linux在shell中获取时间 date巧用
查看>>
gprof使用介绍【转】
查看>>
多标签分类
查看>>
【netcore基础】MVC API全局异常捕捉中间件ExceptionHandlerMiddleWare
查看>>
Python菜鸟快乐游戏编程_pygame(2)
查看>>
工作log
查看>>
SpringBoot系统列 2 - 配置文件,多环境配置(dev,qa,online)
查看>>
C# WPF MVVM QQ密码管家项目(8,完结篇:自动输入QQ号、密码)
查看>>