Hibernate 5 :- org.hibernate.MappingException: Unknown entity
来源:互联网 发布:怎么解绑mac地址 编辑:程序博客网 时间:2024/06/10 18:50
- the method that i buid a sessionFactory is followed ,which will cause the MappintException of Unknown entity
Configuration configuration = new Configuration(); configuration.configure(); ServiceRegistry sr = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); SessionFactory sf = configuration.buildSessionFactory(sr);
- Solution——- remove the codes of serviceRegistry
configuration.configure();//serviceRegistry = new StandardServiceRegistryBuilder() // .applySettings(configuration.getProperties()).build();sessionFactory = configuration.buildSessionFactory();
- Analyse
the first code works fine for Hibernate 4.3.5, but the same code has the same issue for Hibernate 5.
When you do configuration.buildSessionFactory(sr), using Hibernate 5, Configuration losts all information about mapping that gets by call configuration.configure().
So you should use
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
instead.
0 0
- Hibernate 5 :- org.hibernate.MappingException: Unknown entity
- org.hibernate.MappingException: Unknown entity
- org.hibernate.MappingException: Unknown entity
- org.hibernate.MappingException: Unknown entity
- org.hibernate.MappingException: Unknown entity:
- org.hibernate.MappingException: Unknown entity
- org.hibernate.MappingException: Unknown entity:
- org.hibernate.MappingException: Unknown entity:
- org.hibernate.MappingException: Unknown entity:
- org.hibernate.MappingException: Unknown entity:
- org.hibernate.MappingException: Unknown entity
- org.hibernate.MappingException: Unknown entity
- org.hibernate.MappingException: Unknown entity
- org.hibernate.MappingException: Unknown entity
- org.hibernate.MappingException: Unknown entity
- org.hibernate.MappingException: Unknown entity:
- org.hibernate.MappingException: Unknown entity:
- org.hibernate.MappingException: Unknown entity
- Android Recovery升级原理
- Exception不能捕捉到所有的异常
- Thread.sleep()无效?
- 视音频技术[1]
- Java从入门到精通阅读笔记(第4版)8
- Hibernate 5 :- org.hibernate.MappingException: Unknown entity
- Bzoj 2282: [Sdoi2011]消防(二分答案)
- 【转载】VM虚拟机下安装Centos7.0图文教程
- HTTP协议状态码详解(HTTP Status Code)
- 【SSH网上商城项目实战08】查询和删除商品类别功能的实现
- 122.一些第三方库分析
- Oracle创建表空间语句
- 理解 TCP 和 UDP (二)TCP 报文结构
- MAC环境下配置TomCat 7