hibernate-cfx.xml配制文件详解
来源:互联网 发布:疯狂阅读软件 编辑:程序博客网 时间:2024/05/20 03:41
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!--声明Hibernate配置文件的开始-->
<hibernate-configuration>
<!--SessionFactory是Hibernate中的一个类,这个类主要负责保存HIbernate的配置信息,以及对Session的操作-->
<session-factory>
<!--是否在后台显示Hibernate用到的SQL语句,true为显示,false:不显示。-->
<property name="show_sql">true</property>
<!--hibernate.dialect 只是Hibernate使用的数据库方言,就是要用Hibernate连接那种类型的数据库服务器。-->
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
<!--配置数据库的驱动程序-->
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<!--设置数据库的连接url :test为数据库名-->
<property name="hibernate.connection.url">
jdbc:mysql://localhost:3306/test
</property>
<!--连接数据库是用户名-->
<property name="connection.username">
root
</property>
<!--连接数据库是密码-->
<property name="connection.password">
root
</property>
<!--数据库连接池的大小-->
<property name="hibernate.connection.pool.size">20</property>
<!--jdbc.fetch_size是指Hibernate每次从数据库中取出并放到JDBC的Statement中的记录条数。Fetch Size设的越大,读数据库的次数越少,速度越快,Fetch Size越小,读数据库的次数越多,速度越慢-->
<property name="jdbc.fetch_size">50</property>
<!--jdbc.batch_size是指Hibernate批量插入,删除和更新时每次操作的记录数。Batch Size越大,批量操作的向数据库发送Sql的次数越少,速度就越快,同样耗用内存就越大-->
<property name="jdbc.batch_size">23</property>
<!--jdbc.use_scrollable_resultset是否允许Hibernate用JDBC的可滚动的结果集。对分页的结果集。对分页时的设置非常有帮助-->
<propertyname="jdbc.use_scrollable_resultset">false </property>
<!--connection.useUnicode连接数据库时是否使用Unicode编码-->
<propertyname="Connection.useUnicode">true </property>
<!--connection.characterEncoding连接数据库时数据的传输字符集编码方式-->
<property name="connection.characterEncoding">gbk</property>
<!--hibernate 对数据库表的操作
create-drop:运行时,先创建,运行完,在删除。
create:每次运行前都会删除已有的。在创建。 测试时,可以使用create.
update:映射文件和表。不会重新创建表及不会重新执行ddl语句,只会更新表中的记录。
validate:看映射文件和表是不是对应,如果不对应,他也不会更新,会报错。经常用它,保险一些
-->
<property name="hibernate.hbm2ddl.auto">update</property>
<!--指定映射文件”-->
<mapping resource="com/bjsxt/hib/manytomany/Student.hbm.xml"/>
</session-factory>
</hibernate-configuration>
- hibernate-cfx.xml配制文件详解
- hibernate配制文件三(Hiebernate.cfg.xml)
- hibernate配制文件一(配置文件中映射元素详解 )
- WCF配制文件详解
- MongoDB配制文件详解
- Hibernate bean 对象配制文件
- hibernate配制文件五(Hibernate映射类型)
- hibernate.config.xml文件详解
- hibernate.cfg.xml文件详解
- hibernate.cfg.xml文件详解
- hibernate.cfg.xml文件详解
- hibernate.cfg.xml文件详解
- Hibernate详解(二)--hibernate.cfg.xml文件
- hibernate配制文件四(对象标识符号)
- Hibernate 主清单文件配制说明
- hibernate.cfg.xml文件配置标签详解
- 配制文件
- hibernate配制文件二(组件应用的方法)
- C/C++中#和##的含义
- Linux下安装CVS服务器
- jstring, String, char* 变换函数
- Java写入Excel文件
- java.lang.classcastexception:android.widget.TextView错误
- hibernate-cfx.xml配制文件详解
- BITMAP的定义
- shell编程资料集合
- uva-10152 - ShellSort
- hdu 1269 强联通分量 Tarjan
- morphia query排序
- 并查集算法
- Javascript 从一段字符中得到第一个出现的数(供备忘)
- 并查集(不相交集合)基础知识详解