读书人

容易的hibernate示例(第一个)

发布时间: 2012-09-18 16:21:42 作者: rapoo

简单的hibernate示例(第一个)

一下代码,是我简单写的hibernate的示例,很简单,算是对hibernate的的回忆,很简单

pojo类,user,代码如下:

<!DOCTYPE hibernate-configuration PUBLIC"-//Hibernate/Hibernate Configuration DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory name="foo"><property name="show_sql">true</property><property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property><property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernate_first</property><property name="hibernate.connection.username">root</property><property name="hibernate.connection.password">891220</property><property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property><!-- 设置关联资源 --><mapping resource="com/pzoom/xiaochen/pojo/User.hbm.xml"/></session-factory></hibernate-configuration>


呵呵,很简单的代码,大家看看,仅作参考


读书人网 >其他数据库

热点推荐