hibernate框架的核心配置文件=====hibernate.cfg.xml
来源:互联网 发布:java读取gz文件 编辑:程序博客网 时间:2024/06/05 16:57
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"><hibernate-configuration> <session-factory> <!-- property 元素用于配置Hibernate中的属性 键:值 --> <!-- hibernate.connection.driver_class : 连接数据库的驱动 --> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <!-- hibernate.connection.username : 连接数据库的用户名 --> <property name="hibernate.connection.username">root</property> <!-- hibernate.connection.password : 连接数据库的密码 --> <property name="hibernate.connection.password">123</property> <!-- hibernate.connection.url : 连接数据库的地址,路径 --> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernatedemo</property> <!--------------------------------------------------------------------------------> <!-- show_sql: 操作数据库时,会 向控制台打印sql语句 --> <property name="show_sql">true</property> <!--------------------------------------------------------------------------------> <!-- format_sql: 打印sql语句前,会将sql语句先格式化 --> <property name="format_sql">true</property> <!--------------------------------------------------------------------------------> <!-- hbm2ddl.auto: 生成表结构的策略配置 update(最常用的取值): 如果当前数据库中不存在表结构,那么自动创建表结构. 如果存在表结构,并且表结构与实体一致,那么不做修改 如果存在表结构,并且表结构与实体不一致,那么会修改表结构.会保留原有列. create(很少):无论是否存在表结构.每次启动Hibernate都会重新创建表结构.(数据会丢失) create-drop(极少): 无论是否存在表结构.每次启动Hibernate都会重新创建表结构.每次Hibernate运行结束时,删除表结构. validate(很少):不会自动创建表结构.也不会自动维护表结构.Hibernate只校验表结构. 如果表结构不一致将会抛出异常. --> <property name="hbm2ddl.auto">update</property> <!--------------------------------------------------------------------------------> <!-- 数据库方言配置 org.hibernate.dialect.MySQLDialect (选择最短的) --> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <!--------------------------------------------------------------------------------> <!-- hibernate.connection.autocommit: 事务自动提交 --> <property name="hibernate.connection.autocommit">true</property> <!--------------------------------------------------------------------------------> <!-- 将Session与线程绑定=> 只有配置了该配置,才能使用getCurrentSession --> <property name="hibernate.current_session_context_class">thread</property> <!--------------------------------------------------------------------------------> <!-- 引入ORM 映射文件 填写src之后的路径 --> <mapping resource="com/itheima/a_hello/User.hbm.xml"/> </session-factory></hibernate-configuration>
阅读全文
0 0
- hibernate框架的核心配置文件=====hibernate.cfg.xml
- Hibernate-02-核心配置文件Hibernate.cfg.xml
- Hibernate -- hibernate.cfg.xml 核心配置文件
- jbpm核心配置文件jbpm.hibernate.cfg.xml的解析
- hibernate的hibernate.cfg.xml配置文件
- 深入Hibernate 的配置文件hibernate.cfg.xml
- Hibernate的配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate配置文件hibernate.cfg.xml的详解
- Hibernate中hibernate.cfg.xml核心配置文件配置
- hibernate.cfg.xml 配置文件
- hibernate.cfg.xml配置文件
- hibernate.cfg.xml配置文件
- KeepVid Pro(网络视频下载工具)官方注册版V7.0.1.2下载 | keepvid pro 破解版
- 有n个人围成一圈,顺序排号。从第一个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号的那位。
- hibernate关系
- sunday 最快的字符串匹配
- 多总结和学习的几篇文章
- hibernate框架的核心配置文件=====hibernate.cfg.xml
- 微信支付SDK接入流程梳理
- 计算字符串中子串出现的次数
- js 对象转数组
- TensorFlow 实现多层 LSTM 的 MNIST 分类 + 可视化
- MongDB安装与连接
- 移植PTZ_continuous_move代码中遇到的soap->error 3
- 关于android的广播机制里面的网络状态监听 (Fragment实现)
- 【深度学习】Ubuntu16.04+Anaconda安装+换源+环境创建+tensorflow安装(3)