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 ...
随机推荐
- noip普及组2004 火星人
火星人 描述 人类终于登上了火星的土地并且见到了神秘的火星人.人类和火星人都无法理解对方的语言,但是我们的科学家发明了一种用数字交流的方法.这种交流方法是这样的,首先,火星人把一个非常大的数字告诉人类 ...
- registry key 'Java Runtime Environment' has value'1.8',but '1.7' is requaired(转)
当更新jdk后,运行java命令可能会提示类似这样registry key 'Java Runtime Environment' has value'1.8',but '1.7' is requair ...
- 对vue生命周期/钩子函数的理解
对于实现页面逻辑交互等效果,我们必须知晓vue的生命周期,才能愉快的玩耍,知道我们写的东西应该挂载到哪里,vue官方给出的api讲解的那叫一个简单啊,如下: 所有的生命周期钩子自动绑定this上下文到 ...
- Java并发包中CopyOnWrite容器相关类简介
简介: 本文是主要介绍,并发容器CopyOnWriteArrayList和CopyOnWriteArraySet(不含重复元素的并发容器)的基本原理和使用示例. 欢迎探讨,如有错误敬请指正 如需转载, ...
- 2015苏州大学ACM-ICPC集训队选拔赛(3)题解
第三次校赛链接:快戳我 1001 考虑前半组数,我们只需要标记每个数出现的次数,再加上这个数之前的数出现的次数,即为这个数在m次操作中总共需要翻转的次数(即求前缀和),再根据翻转的奇偶性判断最后这个位 ...
- ie启动不了的解决办法,win7,win8都可以
今天我的IE也无法打开了,我装的是win7的系统,ie升级到了IE11,无法打开了,看到下面这篇文章,借鉴试试,没想到也成功了. 按以上步骤,打开注册表, 第一步.按下Win+R组合键,在出现的运行命 ...
- 介绍下Python的两个标准库 os 和 sys
import sysprint(sys.path) #python 2 中报错 ....,打印的是绝对路径(***\\python\\lib\\site-packages# 第三方库,后退一级为标准库 ...
- Java 高级特性: Lambda 表达式
本文源代码上传到了码云,请点击 LambdaExpression 获取.Lambda 表达式是 java 8 的新特性,本文讲解了 lambda 表达式的所有知识.内容涉及到 lambda 表达式是什 ...
- JS中的phototype JS的三种方法(类方法、对象方法、原型方法)
JS中的phototype是JS中比较难理解的一个部分 本文基于下面几个知识点: 1 原型法设计模式 在.Net中可以使用clone()来实现原型法 原型法的主要思想是,现在有1个类A,我想要创建一个 ...
- Java jdk 快速配置
JAVA_HOME C:\Program Files\Java\jdk1.8.0_92 Path %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin; CLASSPATH ...