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 ...
随机推荐
- Fiddler简介
官网:http://www.telerik.com/fiddler Fiddler是一个http协议调试代理工具,它能够记录并检查所有你的电脑和互联网之间的HTTP通讯,设置断点,查看所有的" ...
- 如何修改ionic Popup的样式
第一次用ionic的Popup时感觉很好用,但是太丑了.但是又不会修改自定义的样式,只能自己写了个模态框.后来仔细搜索了一下.发现还是可以修改的. var confirmPopup = $ionicP ...
- Linux之旅-ubuntu下搭建nodejs环境
.NET Core也开源了,并且可移植到Linux下,而ubuntu作为linux发行版的翘楚,极大的方便了初学者的入门,搭建完ASP.NET Core运行环境后,作为半前半后的开发人员,就继续着搭建 ...
- 7.21.04 for循环
for循环的三个语句可以放置任何表达式,但是有个不成文的规则,for循环的3个部分应当对同一个计数器变量进行初始化,检测和更新.若不遵循这一规则,编写的循环常常晦涩难懂! 如果在循环第一部分声明了一个 ...
- latex 生成pdf
我个人还是比较推崇传统的方法:先生成dvi,在生成pdf. 直接在winEdt中点击最下方的Windows Command Prompt, 否则从cmd进入命令行的话,还要进入tex文件夹,好麻烦. ...
- Flask01 初识flask、flask配置
1 什么是flask Flask是一个使用 Python 编写的轻量级 Web 应用框架.其 WSGI 工具箱采用 Werkzeug ,模板引擎则使用 Jinja2 . 百度百科:点击前往 中文文档: ...
- Mysql数据库索引
今天,我们来讲讲Mysql数据库的索引的一些东西,想必大家都知道索引能干吗?必然是查找数据表的时候,查找的速度快啊,尤其是那些几百万行的数据库,不建立索引,你是想考验用户的耐心吗?Mysql有多种存储 ...
- RestTemplate post如何传递参数
背景 今天跟同事接口联调,使用RestTemplate请求服务端的post接口(使用python开发).诡异的是,post请求,返回500 Internal Server Error,而使用get请求 ...
- postman 第4节 切换环境和设置读取变量(转)
postman提供了environment管理功能,想要在多个环境中测试,比如在测试环境.灰度环境.生产环境等,只需要用同样的接口,切换下环境即可,非常方便.具体步骤: 切换环境 1.点击界面右上角的 ...
- angular2 官方demo heroApp
最近学习angular2,于是从官网的hero例子开始学习.经过几番周折终于完成了这个例子.收益匪浅.个人建议在开始学习例子前可以先了解一些概念,模块,组件,装饰器.....,有助于写代码时候的逻辑. ...