User.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 package="cn.lsp.hibernate.domain" > <class name="User" table="user" > <!-- 表主键 生成策略 --> <id name="id"> <generator class="native"></generator> </id> <!-- 其他属性的映射name password role --> <property name="name" type="string"></property> <property name="password" type="string"></property> <property name="role" type="string"></property> </class> </hibernate-mapping>