SS3.1_Hibernate_ByMyEclipse 使用MyEclipse创建Hibernate项目
来源:互联网 发布:蓝牙控制单片机程序 编辑:程序博客网 时间:2024/06/09 22:00
在hibernate.cfg.xml文件中配置MySQL数据库连接参数:
<?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">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/testdb</property>
<property name="connection.username">root</property>
<property name="connection.password">123456</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<property name="current_session_context_class">thread</property>
</session-factory>
</hibernate-configuration>
从项目SS1.1_Hibernate_ByManual中把net.nw.dao和net.nw.vo两个包复制粘贴到本项目SS3.1_Hibernate_ByMyEclipse当中直接使用
在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">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/testdb</property>
<property name="connection.username">root</property>
<property name="connection.password">123456</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<property name="current_session_context_class">thread</property>
<mapping resource="net/nw/vo/Student.hbm.xml" />
</session-factory>
</hibernate-configuration>
测试效果截图如下:
- SS3.1_Hibernate_ByMyEclipse 使用MyEclipse创建Hibernate项目
- SS3.2_Hibernate_Annotation 使用Annotation注解实现的Hibernate范例
- MyEclipse的可视化创建Hibernate项目
- 使用myeclipse创建maven项目
- 使用Myeclipse创建Maven项目
- 使用Myeclipse创建Maven项目
- 使用MyEclipse创建第一个Hibernate实例
- S2.1_Struts2_ByMyEclipse使用MyEclipse创建Struts2项目
- 使用Myeclipse创建ExtJS项目HelloWorld程序
- 使用Myeclipse创建第一个Maven项目
- MyEclipse下使用maven创建web项目
- MyEclipse中使用Maven创建web项目
- 使用myeclipse创建maven web项目
- MyEclipse创建hibernate
- Myeclipse自动创建Hibernate
- Idea中使用Maven创建Hibernate项目
- 使用 MyEclipse 插件创建 Hibernate + Struts 实例(动画)
- 使用 MyEclipse 插件创建 Hibernate + Struts 连接oracle实例(动画)
- Android bsdiff/bspatch imgdiff/applypatch
- linux环境下搭建 j2ee环境
- 最后一次异常法_操作笔记
- JNA调用C语言动态链接库学习实践总结
- 字符串与整数的转换函数 atoi 和sprintf
- SS3.1_Hibernate_ByMyEclipse 使用MyEclipse创建Hibernate项目
- Spring学习
- 机器学习十大算法
- C++--第五课-继承
- 初学者必看:VC++、Win32 SDK、MFC的区别~
- linux环境下搭建 j2ee环境_0
- centos7 最小安装网络问题解决
- 笔试题10
- POJ - 1942 D - Paths on a Grid 组合数