---
title: "Hibernate的基本配置"
author: "ytzhsh"
date: "2006-04-28T16:02:26Z"
tags: []
slug: "hibernate"
draft: false
lastmod: "2006-04-28T16:02:26Z"
id: 23918
url: "https://ytzhsh.iteye.com/blog/23918"
---

&lt;hibernate-configuration&gt;
	&lt;session-factory&gt;
		&lt;!-- local connection properties --&gt;
		&lt;property name="hibernate.connection.url"&gt;
			jdbc:mysql://localhost/msgbook?useUnicode=true&characterEncoding=utf-8
		&lt;/property&gt;
		&lt;property name="hibernate.connection.driver_class"&gt;
			org.gjt.mm.mysql.Driver
		&lt;/property&gt;
		&lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt;
		&lt;property name="hibernate.connection.password" /&gt;
		&lt;!-- property name="hibernate.connection.pool_size"&gt;&lt;/property --&gt;
		&lt;!-- dialect for MySQL --&gt;
		&lt;property name="dialect"&gt;
			org.hibernate.dialect.MySQLDialect
		&lt;/property&gt;
		&lt;property name="hibernate.show_sql"&gt;false&lt;/property&gt;
		&lt;property name="hibernate.transaction.factory_class"&gt;
			org.hibernate.transaction.JDBCTransactionFactory
		&lt;/property&gt;
		&lt;mapping resource="UserInfo.hbm.xml" /&gt;
		&lt;mapping resource="MsgbookInfo.hbm.xml" /&gt;
	&lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;