hibernate3.0配置文档hbm.xml和cfg.xml参考
2018-03-24 19:52
197 查看
1.*.hbm.xml
<?xml version="1.0"?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 2018-3-23 17:41:34 by Hibernate Tools 3.5.0.Final -->
<hibernate-mapping>
<class name="com.dao.Entity" table="student">
<!--name是你的实体类路径、table是你的数据库表名 -->
<id name="id" column="Sno" type="string">
<!--name是与数据库表主键对应的属性,column是数据库表的主键 -->
<generator class="assigned" />
<!-- class="assigned"说明主键是自己定的,不是数据库生成的 -->
</id>
<property name="password" column="Cno" type="string">
</property>
</class>
</hibernate-mapping>
2. *.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">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="connection.url">jdbc:sqlserver://localhost:1433;DatabaseName=max</property>
<property name="connection.username">sa</property>
<property name="connection.password">123456</property>
<property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<!-- 连接数据库的方言,不同的数据库都会有自己对应的方言 -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<property name="hibernate.current_session_context_class">thread</property>
<mapping resource="com/dao/Entity.hbm.xml"/>
<!--resource= hbm.xml文件的路径 (注意是“\”,不是“.”)-->
</session-factory>
</hibernate-configuration>
相关文章推荐
- Hibernate之hbm.xml文档配置——详
- Hibernate.hbm.xml配置总结
- 为 eclipse 的 hibernate 配置文件(*.hbm.xml)加上自动提示功能
- hibernate实现jpa文档,persistence.xml配置问题(javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Canno
- Hibernate3.5.4---java application的xml和annotation环境搭建(hibernate.cfg.xml配置文件说明,映射文件Student.hbm.xml说明
- Hibernate-配置文件-映射文件.hbm.xml
- hibernate.cfg.xml配置文件和hbm.xml配置文件 模板
- eclipse hibernate配置文件(*.hbm.xml)加上自动提示功能
- Hibernate --- xxx.hbm.xml映射配置文件详解
- eclipse中hibernate配置*.hbm.xml文件和hibernate.cfg.xml文件使其能自动提示
- intellij配置hibernate自动生成hbm.xml文件
- hibernate.cfg.xml配置文件和hbm.xml配置文件
- hibernate.hbm.xml配置
- 使用Xdoclet生成Hibernate配置文件(hibernate.cfg.xml)和Hibernate映射文件(*.hbm.xml)
- 关于hibernate的hibernate.cfg.xml配置文件包含 .hbm.xml配置文件的路径写法
- hibernate配置详情2(Dept.hbm.xml)
- hibernate hbm.xml配置文件说明
- Hibernate-helloworld-2 hbm.xml配置及其属性说明
- hibernate ---MySQL 数据库 配置的 hbm.xml 文件例子
- hibernate映射文件XXX.hbm.xml配置映射元素详解--对象标识符(OID)