Exception in thread "main" org.hibernate.MappingException: You may only specify a cache for root
如果出现类似下面的错误:
Exception in thread "main" org.hibernate.MappingException: You may only specify a cache for root <class> mappings
at org.hibernate.cfg.Configuration.getRootClassMapping(Configuration.java:2724)
at org.hibernate.cfg.Configuration.applyCacheConcurrencyStrategy(Configuration.java:2764)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1375)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1826)
at zhongfucheng.aa.App5.main(App5.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Process finished with exit code 1
查看你设置的在配置文件设置的缓存类是否是继承着别的类,也就是说:我开始的时候是配置的是Monkey这个类…而Monkey这个类继承着Animal,因此报错了。。
也就是说:Hibernate在二级缓存中不能配置子类
Exception in thread "main" org.hibernate.MappingException: You may only specify a cache for root的更多相关文章
- Exception in thread "main" org.hibernate.MappingException: Unknown entity: com.mao.PersonSet
转自:https://blog.csdn.net/vipmao/article/details/51334743
- 在运行Hibernate Hello World程序的时候,抛如下错误: view plain Exception in thread "main" org.hibernate.exception.LockAcquisitionException 解决方法
在运行Hibernate Hello World程序的时候,抛如下错误: Exception in thread "main" org.hibernate.exception.Lo ...
- Exception in thread "main" org.hibernate.HibernateException: save is not valid without active transaction
在spring4+hibernate4整合过程中,使用@Transactional注解事务会报"Exception in thread "main" org.hibern ...
- Hibernate错误:Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
报错:Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execu ...
- Exception in thread "main" org.hibernate.TransientObjectException: object references an unsaved tran
今天在使用一对多,多对一保存数据的时候出现了这个错误 Hibernate错误: Exception in thread "main" org.hibernate.Transient ...
- ERROR: Field 'PostId' doesn't have a default value Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not execute statement
例子: Post p = new Post(); p.setPostId(3); p.setPostName("技术"); 在执行数据保持时提示session.save(p); 的 ...
- hibernate添加数据时Exception in thread "main" org.hibernate.PropertyValueException: not-null property references a null or transient value: com.javakc.hibernate.test.entity.TestEntity.testName
意思是,一个非null属性引用了一个null或瞬态值.就是在对应实体类配置文件hbm.xml中该属性配置了not-null="true",将其去掉即可.
- Exception in thread "main" org.springframework.beans.factory.BeanCreationException
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error ...
- Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException 解决方法
转自:https://blog.csdn.net/gengkunpeng/article/details/6225286?utm_source=blogxgwz4 1. struts2.3.15 hi ...
随机推荐
- Linux学习总结(十)—— Java开发环境搭建:JDK+Maven
Java开发环境最基础的两个开源软件是JDK和Maven. JDK 到Oracle官网下载相对应的源码包,这里我选择的是:Linux x64系统的jdk-8u131-linux-x64.tar.gz. ...
- Fedora25和win10双系统安装及使问题汇总
安装问题汇总 1.U盘引导制作后,开机出现":Assuming driver cache: write through" 解决方案:经过排查后,怀疑是U盘启动制作出了问题,后来查阅 ...
- win下安装Redmine常见错误解决方案
成长型公司,最近需要项目管理的软件,所以在windows的服务器上搭建了redmine,其中也遇到了两个坑,现记录下来. Redmine是用Ruby开发的基于web的项目管理软件,是用ROR框架开发的 ...
- C语言指针(三)指针传递给函数
实例1:传递一个无符号的long型指针给该函数 #include<stdio.h>#include<time.h>void getSeconds(unsignedlong*pa ...
- 《Java从入门到放弃》JavaSE篇:程序结构
程序的结构一般分为三种: 顺序结构. 选择结构. 循环结构. 一.顺序结构:这个不用多说吧,跟我们平时写文章的顺序一样,从上往下. 二.选择结构:从名字就能看出,要选择嘛,到底是要漂亮滴妹子,还是要有 ...
- BotVS开发基础—2.7 指标MACD
代码 def main(): while true: records = _C(exchange.GetRecords); # 获取K线数据 ,默认为策略界面设置的K线周期, _C 是一个容错的内置函 ...
- Python之set
set set集合,是一个无序且不重复的元素集合 set的优势 set 的访问数度快 set 原生解决数据重复问题 # 数据库中原有 old_dict = { "#1":{ 'ho ...
- css 禁止长按保存功能
*{-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;} 或者指定某个元 ...
- C++与类型转换相关的四个关键字及其特点
1.reinterpret_cast (expression) type-id 必须是一个指针.引用.算术类型.函数指针或者成员指针. 它可以把一个指针转换成一个整数,也可以把一个整数转换成一个指针( ...
- 项目管理svn
https://nchc.dl.sourceforge.net/project/tortoisesvn/1.9.6/Application/TortoiseSVN-1.9.6.27867-x64-sv ...