这次给大家带来hibernate的配置,hibernate配置的注意事项有哪些,下面就是实战案例,一起来看一下。
数据库:mysql
配置文件名 hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?><!doctype hibernate-configuration public
"-//hibernate/hibernate configuration dtd 3.0//en"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"><hibernate-configuration><!-- sessionfactory -->
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/database</property>
<property name="hibernate.dialect">org.hibernate.dialect.mysqldialect</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.password">password</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<mapping resource="com/troyforever/mvc/bean/example.hbm.xml" />
</session-factory></hibernate-configuration>
相信看了本文案例你已经掌握了方法,更多精彩请关注其它相关文章!
相关阅读:
web.xml的配置
spring的mvc配置
hibernate的映射文件详解
spring的配置
以上就是hibernate的配置的详细内容。
