hibernate.cfg.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">  <!-- Generated by MyEclipse Hibernate Tools. -->  <hibernate-configuration>  <session-factory>  <!--Examda提示:数据库用户名

-->  <property name="connection.username">root</property>  <!--数据库URL-->  <property name="connection.url">  jdbc:mysql://localhost:3306/sample  </property>  <!--dialect,每个数据库对应的Dialet匹配其平台特性-->  <property name="dialect">  org.hibernate.dialect.MySQLDialect  </property>  <!--数据库密码-->  <property name="connection.password">123</property>  <!--数据库驱动-->  <property name="connection.driver_class">  com.mysql.jdbc.Driver  </property>  <!--是否将运行产生的sql语句输出到日志-->  <property name="hibernate.show_sql">True</property>  <!--Examda,是否使用数据库外连接-->  <property name="hibernate.use_out_join">True</property>  <!--事务管理类-->  <property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>  <mapping resource="hbm/Case.hbm.xml" />  <mapping resource="hbm/Copt.hbm.xml" />  </session-factory>  </hibernate-configuration>
时间: 2024-08-09 19:53:43

hibernate.cfg.xml文件的说明的相关文章

Hibernate.cfg.xml文件的配置

1.  Hibernate配置 1.1.  可编程的配置方式 一个org.hibernate.cfg.Configuration 实例代表了一个应用程序中Java类型到SQL数据库映射的完整集合.Configuration被用来构建一个 SessionFactory. 映射定义则由不同的XML映射定义文件编译而来. 可以直接实例化Configuration来获取一个实例,并为它指定XML映射定义文件. 如果映射定义文件在类路径(classpath)中,请使用addResource(): Conf

hibernate 不能解析hibernate.cfg.xml 文件

1.hibernate解析hibernate.cfg.xml 文件时出现如下错误. org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542)    at org.hibernate.cfg.Configuration.configure(C

在Idea中自动生成实体类和hibernate.cfg.xml文件

1 按快捷键 ctrl+shift+alt+s调出project structure菜单, 点击项目名称, 添加hibernate模块, 在最右侧点击+号, 添加hibernate.cfg.xml文件 2 点击DataBase中的+号 ,连接 mysql数据库 选择数据库名称,  建立连接 3 在persistence窗口中, 右键, genarate persistence mapping -> from database schema  弹出创建对话框, 配置完点击ok即可 4 如果没有pe

将hibernate.cfg.xml文件都放到spring中时报错

报错如下所示: 私以为是配置文件出现问题了. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.

用hibernate.properties代替hibernate.cfg.xml配置常用的属性

我们使用hibernate时经常在hibernate.cfg.xml文件中配置数据库连接的相关属性,是否显示sql语句,数据库的方言等,这些配置其实也可以在.properties文件中配置.现在我把这把文件的名字起为:hibernate.properties. 思路:写一个domian对象,以及这个domain对象映射到数据库中的.hbm.xml文件.和一个测试类(这个测试类是更新数据库中的一条数据) 以及hibernate.properties文件(这个文件是放在src的下面即在classPa

Hibernate之通过hibernate.cfg.xml配置文件访问数据库的例子

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

关于配置Hibernate的xml文件提示问题

学习Hibernate的过程中发现.hibernate.cfg.xml文件可以自动提示.但是model对应的xxx.hbm.xml却不会自动提示. 记得以前学习struts的时候是可以通过手动设置DTD类型的文件类实现提示的.于是就试了一下.结果就可以了.过程如下. 1.点击Eclipse的Window -> Preferences -> XML -> XML Catalog配置项如下图 2.点击右上角的[Add]按钮.弹出啊添加DTD文件的对话框.如下图所示. 2.1在Location

Hibernate.编写xml文件无自动提示信息

Hibernate.编写xml文件无自动提示信息 注意: 配置 xxxx.hbm.xml 文件的自动提示.和配置 hibernate.cfg.xml 文件的提示,操作步骤是一样的.只是复制的文件内容.选择文件不一样. xxxx.hbm.xml 复制内容是:http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd   选择文件是:hibernate-mapping-3.0.dtd hibernate.cfg.xml 复制内容是:http:

Hibernate----配置文件Hibernate.cfg.xml

在Hibernate中大配置一般命名为"HIbernate.cfg.xml" Hibernate配置文件主要用于配置数据库连接和HIbernate运行时所需要的各种特性. <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "htt