zoukankan      html  css  js  c++  java
  • hibernate.cfg.xml案例

    一、概念。

           hibernate是一个开放源代码的对象关系映射框架,它对JDBC进行了非常轻量级的对象封装,使得Java程序员可以随心所欲的使用对象编程思维来操纵数据库。既然学习Hibernate那么第一步就要学会如何配置hibernate环境。只有配置好环境才能进行hibernate项目的编写。下面我就为大家介绍如何配置Hibernate。

    二、配置Hibernate步骤。

    2.1添加jar包。

    把hibernate-3.2.0.gahibernate-3.2lib下的所有jar包加上。

    2.2编写hibernate.cfg.xml

    <!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="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>  
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernate_frist</property>  
    <property name="hibernate.connection.username">root</property>  
    <property name="hibernate.connection.password">root</property>  
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>  
    <property name="hibernate.show_sql">true</property>  
    <property name="hibernate.format_sql">true</property>  
        <mapping resource="com/bjpowernode/hibernate/User.hbm.xml"/>  
        </session-factory>  
    </hibernate-configuration> 

    搞定!

  • 相关阅读:
    Hive join操作优化
    php中 date 函数中的格式参数
    Mysql分表之后的聚合统计
    使用Elasticsearch-Dump工具复制ES库
    Json Path 语法详解(Java)
    Json Path 语法
    关于qt5.2~qt5.8的下载地址
    RTL8812AU双频无线网卡在ubuntu19和20上的驱动安装
    使用vscode对threejs的本地调试
    ThreeJS中创建文字的几种方法
  • 原文地址:https://www.cnblogs.com/kuangwong/p/6496677.html
Copyright © 2011-2022 走看看