Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not

我手动配置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

时间: 2024-12-28 21:43:50

Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not的相关文章

org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge]

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [beans4.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: could not ins

Hibernate(三): org.hibernate.HibernateException: No CurrentSessionContext configured!

Hibernate版本5.2.9 获取Session的方式是sessionFactory.getCurrentSession(); 比较老一些的版本使用的是sessionFactory.openSession()是不管任何情况都重新开启一个Session. 从两者却别来说getCurrentSession();相对的增加了一个判断,在有Session的情况下就会直接去调用,没有session的话才会创建.比openSession()要好一点. 但是,目前却遇到了问题: 四月 15, 2017 1

Caused by:org.hibernate.HibernateException:Unable to make JDBC Connection

1.错误描述 Caused by:org.hibernate.HibernateException:Unable to make JDBC Connection[jdbc\:mysql\://localhost\:3306/school] 2.错误原因 在hibernate.cfg.xml中配置数据库路径时 <property name="connection.url"> jdbc\:mysql://localhost\:3306/school </property&

异常:org.hibernate.HibernateException: &#39;hibernate.dialect&#39; must be set when no Connection available

spring整合hibernate报了这样一个异常,一直以为是dialect参数的问题,最后发现原来是配数据源时,数据库的名字写错了....... 找了半天,重新写了配置文件没出问题,但就不知道这个文件哪里出问题了.配置文件里面这种细节一定要注意. 版权声明:本文为博主原创文章,未经博主允许不得转载. 异常:org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available

Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when &#39;hibernate.dialect&#39; not set

java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125) at org.springframework.test.context.suppo

使用hibernate时出现 org.hibernate.HibernateException: Unable to get the default Bean Validation factory

hibernate 在使用junit测试报错: org.hibernate.HibernateException: Unable to get the default Bean Validation factory at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:127) at org.hibernate.cfg.Configuration.appl

org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml

org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542) at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1035) at

org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

使用Hibernate 插入List数据时出现了以下异常: 1 SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8] 2 SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details. 3 log4j:WARN No appenders co

hibernate 错误:org.hibernate.HibernateException: Unable to get the default Bean Validation factory

最近在自学Hibernate与Struts2进行集成时,出现了一个错误,错误截图如下: 错误代码如下: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for