<?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节点就够了,除非我们中间使用了多个数据库--> <session-factory> <!--用户名 --> <property name="connection.username">root</property> <!--url信息 --> <property name="connection.url">jdbc:mysql://localhost:3306/bookstore</property> <!--数据库方言信息--> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <!--密码 --> <property name="connection.password">hjzgg5211314</property> <!--数据库驱动信息 --> <property name="connection.driver_class">org.gjt.mm.mysql.Driver</property> <!--指定Hibernate映射文件路径 --> <!-- 字符集乱码问题 --> <property name="connection.useUnicode">true</property> <property name="connection.characterEncoding">UTF-8</property> <!-- 控制台输出sql语句 --> <property name="show_sql">true</property> <property name="format_sql">true</property> <mapping resource="com/entry/books.hbm.xml" /> <mapping resource="com/entry/publishers.hbm.xml" /> </session-factory> </hibernate-configuration>