Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
docs.jboss.org文档示例代码:(http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html_single/)
static {
try {
sessionFactory = new AnnotationConfiguration()
.configure().buildSessionFactory();
} catch (Throwable ex) {
// Log exception!
throw new ExceptionInInitializerError(ex);
}
}
测试时出现Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
自己依赖的是hibernate-core-4.2.7.Final.jar
改成:
Configuration cfg = new Configuration().configure();
ServiceRegistry serviceRegistry= new ServiceRegistryBuilder().applySettings(cfg.getProperties()).buildServiceRegistry();
sessionFactory = cfg.buildSessionFactory(serviceRegistry);
Hibernate官网上没找到说明。网上找的。
Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set的更多相关文章
- Connection cannot be null when 'hibernate.dialect' not set
严重: Exception sending context initialized event to listener instance of class [org.springframework.w ...
- org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto ...
- Invocation of init method failed; nested exception is org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl
严重: Exception sending context initialized event to listener instance of class org.springframework.we ...
- 正确决解Hibernate4.*中:Connection cannot be null when 'hibernate.dialect' not set
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hi ...
- Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.cache.ehcache.EhCacheRegionFactory] as strategy [org.hibernate.cache.spi.RegionFac
警告: Exception encountered during context initialization - cancelling refresh attempt: org.springfram ...
- Hibernate(三): org.hibernate.HibernateException: No CurrentSessionContext configured!
Hibernate版本5.2.9 获取Session的方式是sessionFactory.getCurrentSession(); 比较老一些的版本使用的是sessionFactory.openSes ...
- hibernate报错org.hibernate.HibernateException: No CurrentSessionContext configured!
org.hibernate.HibernateException: No CurrentSessionContext configured! at org.hibernate.internal.Ses ...
- Caused by:org.hibernate.HibernateException:Unable to make JDBC Connection
1.错误描述 Caused by:org.hibernate.HibernateException:Unable to make JDBC Connection[jdbc\:mysql\://loca ...
- Caused by: org.hibernate.HibernateException: identifier of an instance of ... is alterde from
Caused by: org.hibernate.HibernateException: identifier of an instance of ... is alterde from Hi ...
随机推荐
- C# 整形、双精度浮点型、字符串与字节型的相互转化
整形.双精度浮点型.字符串与字节型的相互转化,如下 using System; using System.Collections.Generic; using System.Linq; using S ...
- iOS -Swift 3.0 -UILabel属性大全
昨天研究了一下苹果近两年新出的Swift语言,感觉学起来并不是很吃力,毕竟自己有过Objective-C的语言功底,所以各方面的属性控件还是一眼就可以认出的,只是Swift的写法与Objective- ...
- Real-Time SQL Monitoring
Real-Time SQL Monitoring可以在sql运行的时候监控其性能. 缺省情况下,单个sql执行花费的CPU或I/O时间超过5秒或sql并行执行的时候,Real-Time SQL Mon ...
- First learning operation system
1,操作系统负责管理硬件资源,为应用程序的开发执行提供基础 2,用户空间包括应用程序,只能通过调用系统调用访问硬件,无法访问更小粒度功能 3,设备驱动程序函数和内核子系统的函数对用户不可见 4,操作系 ...
- display:flex 多栏多列布局
转自:http://www.360doc.com/content/14/0811/01/2633_400926000.shtml display:flex 多栏多列布局浏览器支持情况:火狐直接支持w3 ...
- Dropbox能火,为何它的中国同行不能火?
http://tech.163.com/15/0510/11/AP8II63H000915BF.html Dropbox能火,为何它的中国同行不能火? 2015-05-10 11:33:55 来源: ...
- 圆的反演变换(HDU4773)
题意:给出两个相离的圆O1,O2和圆外一点P,求构造这样的圆:同时与两个圆相外切,且经过点P,输出圆的圆心和半径 分析:画图很容易看出这样的圆要么存在一个,要么存在两个:此题直接解方程是不容易的,先看 ...
- Java基础(4):Scanner输入的典型应用
import java.util.Scanner; /* * 功能:为指定的成绩加分,直到分数大于等于60为止 * 输出加分前的成绩和加分后的成绩,并且统计加分的次数 * 步骤: * 1.定义一个变量 ...
- Java编程思想(一):大杂烩
在java中一切都被视为对象.尽管一切都是对象,但是操纵的标识符实际上是对象的一个引用,可以将引用想象成是遥控器(引用)来操纵电视机(对象).没有电视机,遥控器也可以单独存在,即引用可以独立存在,并不 ...
- Codeforces Round #325 (Div. 1) D. Lizard Era: Beginning
折半搜索,先搜索一半的数字,记录第一个人的值,第二个人.第三个人和第一个人的差值,开个map哈希存一下,然后另一半搜完直接根据差值查找前一半的答案. 代码 #include<cstdio> ...