标签:main version src nbsp 方言 res cfg.xml www generator
JavaBean.hbm.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <!-- name:JavaBean类全路径 table:表名字 --> <class name="com.itheima.elec.domain.ElecText" table="elec_text"> <!-- name:主键 type:主键类型,可忽略 column:貌似也是主键 --> <id name="textID" type="String" column="textID"> <!-- 这个uuid,名词是什么忘记 --> <generator class="uuid"></generator> </id> <!-- 配置表其他的属性 --> <property name="textName" type="String" column="textName"></property> <property name="textDate" type="date" column="textDate"></property> <property name="textRemark" type="String" column="textRemark"></property> </class> </hibernate-mapping>
hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- 必须也要配置的参数有5个,4大参数,数据库的方言 --> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/struts_day01</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">123</property> <!-- 数据库的方言 --> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <!-- 其他配置 --> <!-- 添加JavaBean映射的文件 --> <mapping resource="/itcast1128elec/src/com/itheima/elec/domain/ElecText.hbm.xml"/> </session-factory> </hibernate-configuration>
标签:main version src nbsp 方言 res cfg.xml www generator
原文地址:http://www.cnblogs.com/tidhy/p/6764955.html