hibernate之hibernate.cfg.xml详解

来源:互联网 发布:淘宝类似图片怎么搜索 编辑:程序博客网 时间:2024/06/06 08:32
<!DOCTYPE hibernate-configuration PUBLIC"-//Hibernate/Hibernate Configuration DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- hibernate-configuration为hibernate配置头文件 --><hibernate-configuration><!-- 配置session-factory,     SessionFactory是Hibernate的工厂类,              该类负责Hibernate的配置和Hiberante的Session接口中save(),update(),delete(),load(),find()的操作  --><session-factory><!-- 1.数据库连接配置 --><!-- 数据库连接url --><property name="connection.url">jdbc:mysql://192.168.200.12:3306/hbtest</property><!-- 数据库连接用户名 --><property name="connection.username">root</property><!-- 数据库连接口令 --><property name="connection.password">root123</property><!-- 数据库连接驱动 --><property name="connection.driver_class">com.mysql.jdbc.Driver</property><!-- 数据库方言 --><property name="dialect">org.hibernate.dialect.MySQLDialect</property><!-- 数据库连接池大小配置 --><property name="connection.pool_size">1</property><!-- 配置使用二级缓存的类 --><property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property><!-- 一次读的数据库记录数 --><property name="jdbc.fetch_size">50</property><!-- 设定对数据库进行批量删除条数 --><property name="jdbc.batch_size">30</property><!-- 2.是否打印sql配置 --><property name="show_sql">true</property><!-- 3.对象-映射关系文件的位置 --><mapping resource="com/lanhuigu/hibernate/entity/Customer.hbm.xml" /></session-factory></hibernate-configuration>


0 0
原创粉丝点击