Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set——【hibernate 日常错误】
来源:互联网 发布:求生之路2游侠网络联机 编辑:程序博客网 时间:2024/06/12 20:00
EN:Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
CN:访问dialectresolutioninfo不能为空时,方言没有设置。
情况一:未在【Hibernat.cfg.xml 】中配置方言
mysql数据库正常配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="javax.persistence.validation.mode">none</property>
<!-- dialect 数据库方言 -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<!-- 驱动 -->
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- 数据库URL -->
<property name="hibernate.connection.url">jdbc:mysql://localhost:3337/hibernateTest</property>
<!-- 数据库登陆用户名和密码 -->
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<!-- 显示执行SQL语句 -->
<property name="hibernate.show_sql">true</property>
<!-- 格式执行SQL语句 -->
<property name="format.sql">true</property>
<!-- 数据库自动创建表
create—drop 在程序启动时创建数据库表,程序退出时删除之前创建的表(设计阶段使用)
create 在程序启动的时候先删除上一次创建的表,然后再创建表结构(设计阶段使用)
update 在程序启动的时候,如果没有表就创建表,有就检查更新表(推荐使用)
validate 在程序启动的时候检查表结构,不会创建
-->
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping resource="org/enva/pojo/Person.hbm.xml"/>
</session-factory>
</hibernate-configuration>
情况二:Configuration创建错误;
简单的创建,调用例子如下:
import java.util.Date;
import org.enva.pojo.Person;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
public class HibernateTest01 {
public static void main(String[] args) {
Configuration config=new Configuration().configure();
SessionFactory factory=config.buildSessionFactory();
Session session =factory.openSession();
Transaction ts=session.beginTransaction();
Person person=new Person();
person.setName("Tom");
person.setPassword(111111);
person.setBirthday(new Date());
session.save(person);
ts.commit();
session.close();
}
}
- Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set——【hibernate 日常错误】
- [Hibernate]Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- 创建SessionFactory出错Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- Hibernate4.3.x Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- ExceptionInInitialize Access to DialectResolutionInfo cannot be null when 'hibernate.dialect'not set
- [Solved] HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’
- Connection cannot be null when 'hibernate.dialect' not set
- Connection cannot be null when 'hibernate.dialect' not set
- Connection cannot be null when 'hibernate.dialect' not set
- Connection cannot be null when 'hibernate.dialect' not set
- Hibernate Connection cannot be null when 'hibernate.dialect' not set错误
- org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dia
- HIbernate4.2.7错误Connection cannot be null when 'hibernate.dialect' not set
- failed.org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hiber
- 异常记录001—hibernate 4.2.4 Final 测试出现Connection cannot be null when 'hibernate.dialect' not set
- org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set 解决方法
- org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
- ssdb下载安装
- Ubnutu忘记用户密码怎么办
- hdoj 5533 Dancing Stars on Me【数学】
- iOS动画和特效(三)MotionEffects
- Python中的__main__
- Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set——【hibernate 日常错误】
- 底层_读取文件时上锁_demo
- thinkphp3.2 控制器
- vim 正则表达式
- Java源码 SpringMVC Mybatis Shiro Bootstrap Rest Webservice
- MyEclipse代码提示设置
- 68,自定义代码生成快捷键
- [ACM]螺旋
- 自考那些事儿(五):软件开发工具(实践篇)