<many-to-one name="department" class="k.domain.Department" column="department_id" lazy="false"></many-to-one>
采用 lazy="false" 才可以debug到懒加载的数据
<?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>
<class name="k.domain.Employee" table="t_employee">
<id name="id" column="id" type="java.lang.Integer">
<!-- 设置数据库表id增长策略 native:生成表id值就是主键自动增长 uuid -->
<generator class="native"></generator>
</id>
<!-- 配置其他属性和表字段对应 name属性:实体类属性名称 column属性:生成表字段名称 -->
<property name="name" column="name" type="java.lang.String" length="64"></property>
<property name="email" column="email" type="java.lang.String" length="64"></property>
<property name="hireDate" column="hireDate" type="java.util.Date"></property>
<property name="salary" column="salary" type="java.lang.Float"></property>
<property name="password" column="password" type="java.lang.String" length="64"></property>
<property name="grade" column="grade" type="java.lang.Integer" length="3"></property>
<many-to-one name="department" class="k.domain.Department" column="department_id" lazy="false"></many-to-one>
</class>
</hibernate-mapping>