Hibernate配置文件与映射文件的创建
2016-02-29 19:39
274 查看
1. config文件的创建:
内容:
<?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="connection.username">root</property>
<property name="connection.password">root</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql:///hibernate?useUnicode=true&characterEncoding=UTF-8</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<property name="hibernate.current_session_context_class">thread</property>
<mapping resource="entity/Students.hbm.xml"/>
</session-factory>
</hibernate-configuration>
2.mapping文件的创建:
内容:
<?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="connection.username">root</property>
<property name="connection.password">root</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql:///hibernate?useUnicode=true&characterEncoding=UTF-8</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<property name="hibernate.current_session_context_class">thread</property>
<mapping resource="entity/Students.hbm.xml"/>
</session-factory>
</hibernate-configuration>
2.mapping文件的创建:
相关文章推荐
- 秋实大哥与快餐店(二进制+字典树)
- 【模拟】HDOJ Clarke and chemistry 5625
- GMM(Gaussian mixture model, 高斯混合模型)
- GT9xxxxx系列------如何加入电源管理模块
- Sunday算法详解
- python iris 数据集
- 安卓菜单的使用系列5:显示弹出菜单
- Android Https
- 构建自己的PHP框架--实现Model类(2)
- 软件工程概论第一节
- 关于编程中遇到inf的情况
- linux内核睡眠与唤醒
- CSS 元素垂直居中的 6种方法
- 数据结构之二叉搜索树
- uva10617
- 截获系统调用(sys_call_table/VFS)
- 表空间使用率
- PASCAL VOC数据集The PASCAL Object Recognition Database Collection
- 《程序员自我修养》第七章读书笔记
- 解决键盘弹起时把UINavigationBar顶出屏幕外面的问题