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 ...
随机推荐
- 复杂DIV交错布局
问题: 请写一段html和CSS实现图中布局: 解析: 考察实现此种效果布局的几种方式. --- 答案:TBD
- 我了解到的JavaScript异步编程
一. 一道面试题 前段时间面试,考察比较多的是js异步编程方面的相关知识点,如今,正好轮到自己分享技术,所以想把js异步编程学习下,做个总结. 下面这个demo 概括了大多数面试过程中遇到的问题: f ...
- Hive调优实践
1 文件格式的选择 ORC格式确实要比textFile要更适合于hive,查询速度会提高20-40%左右 例子1: youtube1的文件格式是TextFIle,youtube3的文件格式是orc h ...
- git 简易使用说明
背景 代码用git管理,所以需要大家熟悉git工具的一些操作 目前我们自动化在develop分支上进行编写 前言 安装git,https://git-scm.com/ 可视化工具推荐,sourcetr ...
- oracle运行速度与效率高的秘密
使用过Oracle的人都知道,Oracle的运行速度与效率,在同类数据库中是名列前茅的,特别是对大量数据进行访问时,更加有出色的表现.那么,Oracle数据库是靠什么实现的呢?笔者下面将通过一系列的文 ...
- 2016-2017 ACM-ICPC, Egyptian Collegiate Programming Contest (ECPC 16) 题解
题目链接:http://codeforces.com/gym/101147 2017/8/27日训练赛,题目情况9/11,Rank 4/79. A. The game of Osho 题意:定义一个子 ...
- bzoj 3529 数表
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=3529 题目大意:令F(i)为i的约数和,多次询问对于1<=x<=n,1< ...
- JS中的循环结构
[循环结构的执行步骤]1.声明循环变量:2.判断循环条件3.执行循环体操作4.更新循环变量然后循环执行2-4,直到条件不成立时,跳出循环.while循环()中的表达式,运算结果可以是各种类型,但是最终 ...
- 高性能消息队列 CKafka 核心原理介绍(上)
欢迎大家前往腾讯云技术社区,获取更多腾讯海量技术实践干货哦~ 作者:闫燕飞 1.背景 Ckafka是基础架构部开发的高性能.高可用消息中间件,其主要用于消息传输.网站活动追踪.运营监控.日志聚合.流式 ...
- CSS中的路径裁剪样式clip-path
前面的话 CSS借鉴了SVG裁剪的概念,设置了clip-path样式,本文将详细介绍路径裁剪clip-path 概述 clip-path属性可以防止部分元素通过定义的剪切区域来显示,仅通过显示的特殊区 ...