美文网首页我爱编程
Hibernate简单应用

Hibernate简单应用

作者: 堇未央 | 来源:发表于2018-04-14 09:14 被阅读0次

    hibernate.cfg.xml简单配置

    <hibernate-configuration>

    <session-factory>

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

    <property name="connction.url">jdbc:mysql://localhost:3306/数据库名称</property>

    <property name="connection.username">数据库用户名</property>

    <property name="connection.password">数据库登陆密码</property>

    数据库方言(mysql版本5.0以上)

    <property name="dialect">org.hibernate.dialect.MySql5Dialect</property>

    </session-factory>

    显示sql语句,默认为false

    <property name="hibernate.show_sql">true</property>

    格式化sql语句

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

    下一个层级的映射文件。用来配置bean对象与数据表之间的关系

    <mapping resource="hibernate/hibernate.hbm.xml"/>

    </session-factory>

    </hibernate-configuration>

    相关文章

      网友评论

        本文标题:Hibernate简单应用

        本文链接:https://www.haomeiwen.com/subject/remkkftx.html