Hibernate.cfg.xml 配置连接MySQL数据库

<?xmlversion='1.0'encoding='utf-8'?>

<!DOCTYPEhibernate-configurationPUBLIC

"-//Hibernate/HibernateConfigurationDTD3.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!--MySqlconnectionsettings

<propertyname="connection.driver_class">com.mysql.jdbc.Driver</property>

<propertyname="connection.url">jdbc:mysql://localhost:3306/test</property>

<propertyname="connection.username">root</property>

<propertyname="connection.password">root</property>

<propertyname="dialect">org.hibernate.dialect.MySQLDialect</property>

-->

<propertyname="show_sql">true</property>

<propertyname="format_sql">true</property>

<propertyname="current_session_context_class">thread</property>

<propertyname="hbm2ddl.auto">create</property>

<propertyname="myeclipse.connection.profile">

MyEclipseDerby

</property>

<propertyname="connection.url">jdbc:mysql://localhost:3306/test</property>

<propertyname="connection.username">root</property>

<propertyname="connection.password">root</property>

<propertyname="connection.driver_class">

com.mysql.jdbc.Driver

</property>

<propertyname="dialect">org.hibernate.dialect.MySQLDialect</property>

<mappingresource="com/tarena/bam/entity/Account.hbm.xml"/>

</session-factory>

</hibernate-configuration>

相关推荐