Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not
2014-06-09 21:19
645 查看
我手动配置hibernate4.3.4,测试的时候出现:
Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
我是按照官方文档配置的,但是官方文档的代码好像有点问题
这是官方文档里面的那个工具类的部分代码:return new Configuration().configure().buildSessionFactory(
new StandardServiceRegistryBuilder().build() );
搞笑的是,官方文档时没有哪个return,感觉是不是太粗心了
。。。。后来看网上的文档,自己有改了一下,可以了
下面是正确的代码:
Configuration configuration = new Configuration().configure();
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);
return sessionFactory;
Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
我是按照官方文档配置的,但是官方文档的代码好像有点问题
这是官方文档里面的那个工具类的部分代码:return new Configuration().configure().buildSessionFactory(
new StandardServiceRegistryBuilder().build() );
搞笑的是,官方文档时没有哪个return,感觉是不是太粗心了
。。。。后来看网上的文档,自己有改了一下,可以了
下面是正确的代码:
Configuration configuration = new Configuration().configure();
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);
return sessionFactory;
相关文章推荐
- org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set .
- org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
- Hibernate4后出现: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect'
- hibernate第二篇 org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' no
- org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
- org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set 解决方法
- Connection cannot be null when 'hibernate.dialect' not set
- Exception in thread "main" org.hibernate.HibernateException: Connection cannot be null when 'hiberna
- org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dia
- 异常记录001—hibernate 4.2.4 Final 测试出现Connection cannot be null when 'hibernate.dialect' not set
- failed.org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hiber
- ExceptionInInitialize Access to DialectResolutionInfo cannot be null when 'hibernate.dialect'not set
- 马士兵的第一个hibernate程序(Connection cannot be null when 'hibernate.dialect' not set)
- 异常:org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available
- Hibernate Connection cannot be null when 'hibernate.dialect' not set错误
- 创建SessionFactory出错Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- HIbernate4.2.7错误Connection cannot be null when 'hibernate.dialect' not set
- org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available
- Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- ssh整合Caused by: org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection