关于hibernate框架的连接数据库的一些配置问题

org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
本菜在开始学习hibernate被这个问题困扰了n久,google了半天,仍无头绪,最后还是偶然间看到了一些提示,最后成功脱困!orz.

出现这种问题,我其只要在获得配置对象(Configuratioin)的实例后调用它的addClass(class)参数是你所要映射的java类的class类型如:
Configuration config=new Configuration().configure();//在获得hibernate配置对象后
config.addClass(Student.class);//将Student类映射到hibernate.cfg.xml配置文件中
这样就能解决该问题,当然你也可以不用hibernate5.x.x以上的版本,而换用4.x.x的版本,这样就按章正常的配置(直接在hibernate.cfg.xml里用<mapping  resource="" /> )就行了.

猜你喜欢

转载自huyifan951124.iteye.com/blog/2314983