随笔 - 45, 文章 - 2, 评论 - 11, 引用 - 0
数据加载中……

hibernate配置模板

<?xml version='1.0' encoding='gb2312'?>  
<!DOCTYPE hibernate-configuration PUBLIC  
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">  
<hibernate-configuration>  
    <session-factory>  
        <!--显示执行的SQL语句-->  
        <property name="show_sql">true</property>  
        <!--连接字符串-->  
        <property name="connection.url">jdbc:mysql://localhost:3306/Test</property>  
        <!--连接数据库的用户名-->  
        <property name="connection.username">sa</property>  
        <!--数据库用户密码-->  
        <property name="connection.password">sa</property>  
        <!--数据库驱动-->  
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>  
        <!--JDBC连接池(使用内置的连接池)-->  
        <property name="connection.pool_size">1</property>  
        <!--设置Hibernate自动管理上下文的策略-->  
        <property name="current_session_context_class">thread</property>  
        <!--选择使用的方言-->  
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>  
        <!--在启动时删除并重新创建数据库-->  
        <property name="hbm2ddl.auto">create</property>  
        <mapping resource="events/User.hbm.xml"/>  
        <mapping resource="events/Student.hbm.xml"/>  
    </session-factory>  
</hibernate-configuration> 

 

posted on 2011-04-28 18:25 jack zhai 阅读(282) 评论(0)  编辑  收藏 所属分类: hibernate


只有注册用户登录后才能发表评论。


网站导航: