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 ...
随机推荐
- Flask 与 Celery 在 windows 下的集成问题
Flask 与 Celery 在 windows 下的集成问题 所有的 Web 框架内部的视图中不适合执行需要长时间运行的任务,包括 Flask .Django 等.这类型的任务会阻塞 Web 的响应 ...
- Kafka使用入门教程 简单介绍
介绍 Kafka是一个分布式的.可分区的.可复制的消息系统.它提供了普通消息系统的功能,但具有自己独特的设计.这个独特的设计是什么样的呢? 首先让我们看几个基本的消息系统术语: Kafka将消息以 ...
- 解决ScrollView嵌套ViewPager出现的滑动冲突问题
/** * 解决ScrollView嵌套ViewPager出现的滑动冲突问题 */ public class ScrollView1 extends ...
- Android --Spinner--自定义Spinner
主要参考博客Android 实现自定义Spinner 1.Spinner样式 <?xml version="1.0" encoding="utf-8"?& ...
- javascript:void(0)和javascript:;的用法
一.JavaScript:void(0) 我们经常会使用到 javascript:void(0) 这样的代码,那么在 JavaScript 中 javascript:void(0) 代表的是什么意思呢 ...
- MFC对话框Dialog控件处理程序handler因为public修饰符导致无法访问
比如说你的Dialog有一个Button名为Confirm,对应IDC_CONFIRM,处理程序handler为OnConfirm 那么OnConfirm必须是protected属性,如果是publi ...
- PLSQL 申明和游标
--从键盘输入一个数 accept b prompt '请输入一个大于零的数字'; declare anum number := &b; begin loop dbms_output.put_ ...
- css 正方体
<!DOCTYPE html><html lang="zh-cmn-Hans"><head><meta charset="utf ...
- swift语言实战晋级-1 Swift开发环境的搭建
想要进行Swift的学习,必须要有个开发环境.简单的说就是装好了Xcode的Mac系统.那么接下来我们就简单了解一下这方面的内容. 1.1 下载Xcode Xcode是苹果公司出的编程工具,类似于微软 ...
- 锋利的jQuery
今天总要找点东西学习,其实有很多东西要记录,慢慢写,今天看书吧,这几天把这本书看完,这里记一些要点 从头开始记吧 第一章 认识jQuery $就是jQuery的简写 $(function(){}) 就 ...