本节主要内容:
1 myeclipse 中hibernate jar包,mysql连接jar包 导入
2 hibernate.cfg.xml的配置
1 一对一映射已经配置过
2 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-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/bendi?useUnicode=true&CharacterEncoding=utf8</property>
<property name="connection.username">root</property>
<property name="connection.password"> </property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<mapping resource = "Student.hbm.xml"/>
</session-factory>
</hibernate-configuration>