zoukankan      html  css  js  c++  java
  • hibernate.cfg.xml讲解

     1 <session-factory>
     2     <!-- 配置数据库连接信息 -->
     3     <!-- 数据库驱动 -->
     4     <property name="connection.driver_class">
     5         com.mysql.jdbc.Driver
     6     </property>
     7     <!-- url 相当于:jdbc:mysql://localhost:3306/hibernate4-->
     8     <property name="connection.url">
     9         jdbc:mysql:///hibernate4
    10     </property>
    11     <property name="connection.username">root</property>
    12     <property name="connection.password">root</property>
    13     <!-- hibernate可选项信息 -->
    14     <!-- 数据库方言 -->
    15     <property name="dialect">
    16         org.hibernate.dialect.MySQL5Dialect
    17     </property>
    18     <!-- 是否打印sql语句 -->
    19     <property name="show_sql">true</property>
    20     <!-- 格式化sql语句 -->
    21     <property name="format_sql">true</property>
    22     <!-- 数据库更新方式:
    23         create:每次执行 都先把原有数据表删除,然后创建该表
    24          create-drop:使用 create-drop时,在显式关闭SessionFactory时,
    25          将drop掉数据库schema(表). 
    26          validate:检测
    27          update:如果表不存在 则创建,有就不用创建
    28      -->
    29     <property name="hbm2ddl.auto">update</property>
    30     <!-- 映射文件信息 -->
    31     <mapping resource="cn/siggy/pojo/User.hbm.xml" />
    32 </session-factory>
  • 相关阅读:
    启动容器失败:endpoint with name cop already exists in network host.
    docker定时任务执行脚本报错:the input device is not a TTY
    期末总结
    云图学习
    豆瓣top250
    爬取学习
    爬取图片
    爬取学习bs4
    爬取学习 屠戮盗版天堂
    爬取学习
  • 原文地址:https://www.cnblogs.com/jiangjianzhu/p/5535353.html
Copyright © 2011-2022 走看看