Hibernate连接SQL Server2008时候hibernate.cfg.xml和table.hbm.xml文件的配置详情
2012-09-13 14:23
901 查看
首先是:hibernate.cfg.xml
然后是table.hbm.xml
<?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.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property> <property name="dialect">org.hibernate.dialect.SQLServerDialect</property> <property name="connection.url">jdbc:sqlserver://localhost:1433;DatabaseName=Test</property> <property name="connection.username">sa</property> <property name="connection.password">password</property> <mapping resource="com/ljg/domain/Employee.hbm.xml"/> </session-factory> </hibernate-configuration>
然后是table.hbm.xml
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.ljg.domain"> <class name="Employee" table="employee"> <id name="id" column="id" type="java.lang.Integer"> <generator class="native"/> </id> <property name="name" type="java.lang.String"> <column name="name" not-null="false"/> </property> <property name="email" type="java.lang.String"> <column name="email" not-null="false"/> </property> <property name="hireDate" type="java.util.Date"> <column name="hireDate" not-null="false"/> </property> </class> </hibernate-mapping>
相关文章推荐
- Hibernate3.5.4---java application的xml和annotation环境搭建(hibernate.cfg.xml配置文件说明,映射文件Student.hbm.xml说明)
- 根据hibernate.cfg.xml配置文件和相应实体类及其.hbm.xml文件生成对应的数据库表
- hibernate.cfg.xml配置文件和hbm.xml配置文件 模板
- hibernate中连接SQLServer2008的配置文件hibernate.cfg.xml
- Hibernate.cfg.xml注解和*.hbm.xml配置文件
- Hibernate学习-08:配置-核心配置文件hibernate.cfg.xml、映射文件*.hbm.xml
- hibernate+sqlserver2005连接对hibernate.cfg.xml文件的配置
- hibernate.cfg.xml文件连接mySql、Oracle、SqlServer配置
- Hibernate的配置文件 Hibernate.cfg.xml与xxx.hbm.xml
- 使用hibernate连接mysql数据库正向工程hibernate.cfg.xml文件和xxx.hbm.xml配置文件
- 为什么hibernate在不联网的时候解析不了配置文件?(hibernate.cfg.xml)
- 使用hibernate连接mysql数据库正向工程hibernate.cfg.xml文件和xxx.hbm.xml配置文件
- eclipse中hibernate配置*.hbm.xml文件和hibernate.cfg.xml文件使其能自动提示
- 使用Xdoclet生成Hibernate配置文件(hibernate.cfg.xml)和Hibernate映射文件(*.hbm.xml)
- hibernate学习(一)hibernate.cfg.xml文件连接mySql、Oracle、SqlServer配置
- Hibernate3.5.4---java application的xml和annotation环境搭建(hibernate.cfg.xml配置文件说明,映射文件Student.hbm.xml说明
- hibernate.cfg.xml配置文件和hbm.xml配置文件
- hibernate.cfg.xml注解和*.hbm.xml配置文件详解
- Hibernate连接Oracle配置文件-hibernate.cfg.xml
- Hibernate连接MySql数据库时 Hibernate.cfg.xml配置文件