zoukankan      html  css  js  c++  java
  • Hibernate框架大配置关联小配置



     1 <?xml version='1.0' encoding='utf-8'?> 2 <!DOCTYPE hibernate-configuration PUBLIC 3 "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 4 "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> 5 <hibernate-configuration> 6 <session-factory> 7 <property name="connection.driver_class">oracle.jdbc.OracleDriver</property> 8 <property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property> 9 <property name="connection.username">zc</property> 10 <property name="connection.password">zc</property> 11 <!-- 输出所有 SQL 语句到控制台。 --> 12 <property name="hibernate.show_sql">true</property> 13 14 <!-- 在 log 和 console 中打印出更漂亮的 SQL。 --> 15 <property name="hibernate.format_sql">true</property> 16 <!-- 自动生成数据表,update/create --> 17 <property name="hbm2ddl.auto">update</property> 18 <!-- 方言 --> 19 <property name="hibernate.dialect"> org.hibernate.dialect.Oracle10gDialect</property> 20 <!-- 关联小配置 --> 21 <mapping resource="cn/happy/test/Student.hbm.xml"/> 22 </session-factory> 23 </hibernate-configuration>
    hibernate.cfg.xml大配置。
     1 <?xml version='1.0' encoding='utf-8'?>
     2 <!DOCTYPE hibernate-mapping PUBLIC 
     3     "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
     4     "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
     5  
     6  <hibernate-mapping package="cn.happy.entity">
     7  <!-- 实体类和数据库表  -->
     8      <class name="Student" table="Student">
     9          <id name="id" type="int" column="id">
    10          </id>
    11          <property name="name" type="string" column="name"/>
    12          <property name="age" type="int" column="age"/>
    13      </class>    
    14  </hibernate-mapping>

    Student.hbm.xml小配置。



  • 相关阅读:
    中美土味摄影联合展览4.0
    计算机系统漫游
    Python连接Redis连接配置
    对kotlin和java中的synchronized的浅谈
    不务正业
    功能性测试分类
    Golang os/exec 实现
    面试研究所
    operator和if结构
    Mechanism for self refresh during C0
  • 原文地址:https://www.cnblogs.com/1And0/p/5815086.html
Copyright © 2011-2022 走看看