在使用Hibernate是发现如下的错误:
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested
service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
原因是在建立SessionFactoy
private static SessionFactory sf; static{ sf=new Configuration().buildSessionFactory(); }
没有加入config()。正确的方法应该是
private static SessionFactory sf; static{ sf=new Configuration().configure().buildSessionFactory(); }