原创
链接:https://pan.baidu.com/s/1S-x271CT3wBqQodfFI1dZg 密码:ghti
hiberdate3的下载链接如上
hibernate3在MyEclipse2014中的配置
第一步:
将有关包导入项目的lib目录下,基本包如下,在lib目录下
配置hibernate.cfg.xml文件(我用的是SQL,此文件放在src下)
<?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.microsoft.sqlserver.jdbc.SQLServerDriver</property> <property name="connection.url">jdbc:sqlserver://localhost:1433; DatabaseName=DB OF CWM</property> <property name="connection.username">sa</property> <property name="connection.password">******</property> <property name="dialect">org.hibernate.dialect.SQLServerDialect</property> <property name="show_sql">true</property> <mapping resource="hibernate/Student.hbm.xml" /> </session-factory> </hibernate-configuration>
配置****.hbm.xml(此文件要和PO放在同一个包下)
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="hibernate"> <class name="hibernate.Student" table="Student"> <id name="sno" column="sno"> <generator class="assigned"/> </id> <property name="sname"/> <property name="ssex"/> <property name="sage"/> <property name="sdept"/> </class> </hibernate-mapping>
20:46:15
2018-11-17