hibernate.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory>
  <!-- <property name="hibernate.connection.url">jdbc:mysql://地址/hdb</property>
  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.username">root</property>
  <property name="hibernate.connection.password">pck</property> -->
  <!-- mysql数据的方言 -->
  <!--<property name="dialect">org.hibernate.dialect.MySQLDialect</property> -->
  
  <property name="hibernate.connection.url">jdbc:oracle:thin:@地址:1521:orcl</property>
  <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
  <property name="hibernate.connection.username">customer</property>
  <property name="hibernate.connection.password">customer</property>
  <!-- Oracle数据的方言 -->
  <property name="dialect">org.hibernate.dialect.OracleDialect</property>
  <!-- 查看sql语句 -->
  <property name="show_sql">true</property>
  <!-- 自动生成表 -->
  <property name="hibernate.hbm2ddl.auto">update</property>
  <!-- 路径 -->
  <mapping resource="com/model/Teacher.hbm.xml"/>
 </session-factory>
</hibernate-configuration>

时间: 2024-08-12 01:25:50

hibernate.hbm.xml的相关文章

hibernate.hbm.xml文件配置入门小结(1)

在Hibernate中,各表的映射文件xxx.hbm.xml可以通过工具生成,例如在使用MyEclipse开发时,它提供了自动生成映射文件的工具. hibernate.hbm.xml文件的基本结构如下: [html] view plain copy print? 1   <?xml version="1.0" encoding='UTF-8'?> 2 3   <!DOCTYPE hibernate-mapping PUBLIC 4        "-//Hi

配置hibernate.hbm.xml与配置hibernate.cfg.xml的头部一点小区别

配置hibernate.hbm.xml的头部是: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&g

hibernate.hbm.xml详解

在Hibernate中,各表的映射文件….hbm.xml可以通过工具生成,例如在使用MyEclipse开发时,它提供了自动生成映射文件的工具.配置文件的基本结构如下: 1 <?xml version="1.0" encoding='UTF-8'?> 2 3 <!DOCTYPE hibernate-mapping PUBLIC 4 "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 5 "http://

hibernate.hbm.xml 配置总结

大部分内容取自: [Hibernate总结系列]....hbm.xml配置 基本配置结构 1 <?xml version="1.0" encoding='UTF-8'?> 2 <!DOCTYPE hibernate-mapping PUBLIC 3 "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 4 "http://hibernate.sourceforge.net/hibernate-mappi

spring applicationContext.xml和hibernate.cfg.xml设置

applicationContext.xml配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://ww

hibernate.cfg.xml配置文件和hbm.xml配置文件 模板

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

使用oracle数据库和MySQL数据库时hibernate的映射文件.hbm.xml的不同

如果是使用oracle数据库,那么hibernate的映射文件.hbm.xml如下: <id name="xuehao" column="xuehao"> </id> 这个id不是数据库自动生成的,这需要注意:而且这些字段必须和实体类中相对应,实体类中还需要对应的get()方法和set()方法. 因为oracle数据库中的id都是自动生成的,所以这里不需要写数据库的id,这和MySQL数据库有很大区别:另外,MySQL数据库建表时必须指明id

Caused by:org.hibernate.MappingNotFoundException:resouce:com/you/model/Monkey.hbm.xml not found

1.错误描述 2.错误原因 由于在hibernate.cfg.xml中配置Monkey.hbm.xml路径时,Monkey.hbm.xml放置在src同一级,之前是放在com/you/model下,故路径错误 3.解决办法 将Monkey.hbm.xml放在com/you/model目录下

intellij 编译 springmvc+hibernate+spring+maven 找不到hbm.xml映射文件

1. 错误信息 Invocation of init method failed; nested exception is org.hibernate.MappingNotFoundException: resource: model/Department.hbm.xml not found at 2. 错误分析 (1)项目的hibernate逆向工程是用intellij的persistant工具来完成的,最终完成后,模型对象和映射文件都保存在了model的目录下. (2)由于我们设定了src文