一、首先学习hibernate.cfg.xml配置文件的具体配置
<?xml version="1.0" encoding="UTF-8"?>
<!--指定该文件的官方dtd-->
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" >
<hibernate-configuration>
<session-factory>
<!-- 显示sql语言 -->
<property name="show_sql">true</property>
<!-- sql语言 -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- jdbc驱动程式 -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- jdbc url -->
<property name="connection.url">jdbc:mysql://localhost:3306/test</property>
<!-- 数据库用户名 -->
<property name="connection.username">root</property>
<!-- 数据库密码 -->
<property name="connection.password">wyq</property>
<!-- C3P0连接池设定 -->
<!--最小连接数-->
<property name="c3p0.min_size">5</property>
<!--最大连接数-->
<property name="c3p0.max_size">20</property>
<!--延迟所允许的时间-->
<property name="c3p0.timeout">1800</property>
<!--缓存所允许的最大连接数-->
<property name="c3p0.max_statements">50</property>
<!-- 每隔100笔资料送入资料库,清除缓存(定期清除缓存,减小压力) -->
<property name="hibernate.jdbc.batch_size">100</property>
<!-- 设定事务管理的工厂类 -->
<property name="hibernate.transaction.factiory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<mapping resource="com/wyq/hibernate/pojo/User.hbm.xml"/>
<mapping resource="com/wyq/hibernate/pojo/TUser.hbm.xml"/>
<mapping resource="com/wyq/hibernate/pojo/Room.hbm.xml"/>
</session-factory>
</hibernate-configuration>
需要的jar包有c3p0.jar,hibernate3.jar,数据库.jar,log4j.jar
分享到:
相关推荐
hibernate.cfg.xml hibernate框架的配置文件
Hibernate配置文件hibernate.cfg.xml中配置信息详解!
这是Hibernate的配置文件,hibernate.cfg.xml的具体写法,共友友们参考~~谢谢~
高级Hibernate4开发技术:ORM思想,hibernate介绍,hibernate.cfg.xml配置,hbm.xml映射文件详解,主键生成策略使用,PO对象状态及状态的转换分析、一级缓存,Hibernate数据检索技术,Hibernate高级映射技术,...
websphere_plugin-cfg.xml文件内容解析.pdf
hibernate配置文件hibernate.cfg.xml的详细解释
由于spring对hibernate配置文件hibernate.cfg.xml的集成相当好,可以在项目中放弃hibernate.cfg.xml文件,介绍mappingLocations、mappingDirectoryLocations与mappingJarLocations的用法和区别
hibernate.cfg.xml文件详细解释收集的一个比较好的hibernate.cfg.xml文件解释
高级Hibernate4开发技术:ORM思想,hibernate介绍,hibernate.cfg.xml配置,hbm.xml映射文件详解,主键生成策略使用,PO对象状态及状态的转换分析、一级缓存,Hibernate数据检索技术,Hibernate高级映射技术,...
Hibernate.cfg.xml配置总结
activiti.cfg.xml和application.properties文件的整合配置,不能两个都存在,方便,适应
(hibernate调用C3p0)hibernate.cfg.xml
NULL 博文链接:https://15090079858-163-com.iteye.com/blog/1185564
hibernate.cfg.xml中各节点的所有属性值,取自hibernate官网,纯天然无污染。原装!