1.创建如下javaweb项目结构

11.hibernate的连接查询

11.hibernate的连接查询

2.在项目的src下创建hibernate.cfg.xml主配置文件

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" >
 3 <hibernate-configuration>
 4   <session-factory>
 5     <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
 6     <property name="connection.url">jdbc:oracle:thin:@127.0.0.1:1521:orcl</property>
 7     <property name="connection.username">scott</property>
 8     <property name="connection.password">tiger</property>
 9     <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
10     <property name="show_sql">true</property>
11     <property name="format_sql">true</property>
12     <mapping resource="com/entity/Dept.hbm.xml"/>
13     <mapping resource="com/entity/Emp.hbm.xml"/>
14   </session-factory>
15 </hibernate-configuration>
hibernate.cfg.xml

相关文章:

  • 2021-09-25
  • 2022-12-23
  • 2021-11-20
  • 2021-11-20
  • 2021-05-20
  • 2021-08-29
  • 2021-09-15
猜你喜欢
  • 2021-07-10
  • 2021-11-01
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
相关资源
相似解决方案