Hibernate概述
优缺点
与Mybatis比较
配置Hibernate框架
下载并部署jar文件
编写Hibernate配置文件
添加本地dtd文件映射(提供编码提示,可添加configuration和mapping)
<!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 name="connection.driver_class">oracle.jdbc.OracleDriver</property> ???????<property name="connection.url">jdbc:oracle:thin:@localhost:1521:database_name</property> ???????<property name="connection.username">scott</property> ???????<property name="connection.password">orcl</property> ???????????????<!-- 辅助参数 --> ???????<!-- <property name="show_sql">true</property> --> ???????<property name="format_sql">true</property> ???????<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property> ???????<property name="current_session_context_class">thread</property> ???????????????<!-- 映射信息 --> ???????<mapping resource="org/hibernate/test/legacy/Simple.hbm.xml"/> ???</session-factory> ???</hibernate-configuration>
创建持久化类和映射文件
使用Hibernate API
Hibernate对象状态
脏检查与刷新缓存
更新数据的方法
Hibernate入门
原文地址:https://www.cnblogs.com/xhddbky/p/9554573.html