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">
<hibernate-configuration>
<session-factory>
<!-- 配置hibernate方言 -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="jdbc.batch_size">20</property>
<property name="connection.autocommit">true</property>
<!-- 显示sql语句 -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<!-- 编码 -->
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">UTF-8</property>
<!-- 在下面添加hibernate的实体映射文件 -->
【注意】根据自己的项目配置自己的映射文件
<mapping resource="com/tencent/qqzone/pojo/LogCategory.hbm.xml" /><mapping resource="com/tencent/qqzone/pojo/LogInfo.hbm.xml" />
</session-factory>
</hibernate-configuration>