懒加载数据

员工:${emp.empName }<br />
部门:${emp.dept.name }spring

一、在service层得到数据app

二、关闭懒加载url

经过员工得到所在部门的名称,则在员工方设置。spa

<many-to-one name="dept" column="dept_id" class="Dept" lazy="false"></many-to-one>hibernate

三、OpenSessionInViewFiltercode

  <filter>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>OpenSessionInViewFilter</filter-name>
        <url-pattern>*.action</url-pattern>
    </filter-mapping>
相关文章
相关标签/搜索