hibernate基础配置
来源:互联网 发布:java md5密钥加密算法 编辑:程序博客网 时间:2024/06/18 17:38
hibernate.cfg.xml的配置
<?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 name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property><property name="hibernate.connection.url">jdbc:mysql:///hibernate3</property><property name="hibernate.connection.username">root</property><property name="hibernate.connection.password">123</property><!-- 配置数据库连接方言 --><property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property><!-- 自动建表 --><property name="hibernate.hbm2ddl.auto">update</property><!-- 在日志中输出sql --><property name="hibernate.show_sql">true</property><property name="hibernate.format_sql">true</property><!-- 加载hbm --><mapping resource="web/domain/Customer.hbm.xml"/><mapping resource="web/domain/Book.hbm.xml"/></session-factory></hibernate-configuration>
hbm的配置
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping><!-- 类与表的映射 --><class name="web.domain.Customer" table="customer" catalog="hibernate3"><!-- 属性的映射 --><!-- 主键 name:属性名(类中)column:数据表中名 可省略type:类型可省略--><id name="id" column="id" type="int"><!-- identity主键自增涨 --><generator class="identity"></generator></id><!-- 普通属性 --><property name="name" column="name" type="java.lang.String"></property> <!-- java类型 --><property name="age" column="age" type="int"></property><property name="city"><column name="city" sql-type="varchar(20)"></column><!-- sql类型 --></property></class></hibernate-mapping>
0 0
- Hibernate入门 - 基础配置
- Hibernate入门 - 基础配置
- Hibernate入门 - 基础配置
- Hibernate基础配置
- Hibernate--基础配置
- Hibernate入门 - 基础配置
- Hibernate入门 - 基础配置
- Hibernate - 基础配置
- hibernate基础配置说明
- Hibernate入门 - 基础配置
- Hibernate入门 - 基础配置
- Hibernate入门 - 基础配置
- 基础配置hibernate 项目
- Hibernate 基础配置
- Hibernate之基础配置
- Hibernate的基础配置
- Hibernate基础配置
- 016:hibernate基础配置
- Spring事务使用的一个误区
- Container With Most Water
- vb.net总结
- 对象属性转成表字段
- 注解@Resource实现机制
- hibernate基础配置
- xcode6.1中storyboard怎样跟模拟器一样大?模拟器怎样设置大小?
- Java Socket编程 标准范例(多线程)
- unity3D—SQL基本操作
- 如何设置按钮背景图片
- 如何让python输出中文
- Java生成缩略图
- ubuntu12.10安装Linux 3.11内核
- ZOJ3349——Special Subsequence