首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

hibernate.cfg.xml资料详解

2012-09-24 
hibernate.cfg.xml文件详解?xml version1.0 encodingutf-8?!DOCTYPE hibernate-configuration PU

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>  

??????? <!--? 数据库连接设置 -->
??????? <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
??????? <property name="connection.url">jdbc:mysql://localhost/hibernate</property>
??????? <property name="connection.username">root</property>
??????? <property name="connection.password">root</property>  

??????? <!-- JDBC connection pool (use the built-in) -->
??????? <!-- <property name="connection.pool_size">1</property>-->  

??????? <!-- SQL dialect 方言 -->??????
??????? <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
???????
??????? <!-- Enable Hibernate's automatic session context management -->
??????? <!-- <property name="current_session_context_class">thread</property>-->  

??????? <!-- Disable the second-level cache 2级缓存 -->
??????? <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>  

??????? <!--??? show_sql?? 生成sql语句 -->
??????? <property name="show_sql">true</property>????????
???????? <!--?? format_sql? 生成更漂亮的sql语句 -->
??????? <property name="format_sql">true</property>  

??????? <!-- 取值 validate | update | create | create-drop? -->
??????? <property name="hbm2ddl.auto">create</property>?   

?????? ?<!-- 添加实体类的映射文件? -->
??????? <mapping resource="com/cfeers/hibernate/model/Student.hbm.xml"/>
???????? <!-- Annotation方式配置?? -->
??????? <mapping class="com.cfeers.hibernate.model.Teacher"/>
??????????????????
??? </session-factory>  

</hibernate-configuration>

热点排行