hibernate延迟加载问题!!!
我现在操作的是中间表对象
po:
public class Role_Plate extends BaseModel {
private Plate plate;
private UserMag_b_RightTeam role;
配置hbm.xml:
<class name="com.Blank.model.Role_Plate" table="role_plate">
<id name="id" type="java.lang.String">
<column name="id" length="50" />
<generator class="uuid.hex" />
</id>
<many-to-one name="plate" class="com.Blank.model.Plate" fetch="select" >
<column name="plate_id" not-null="true" />
</many-to-one>
<many-to-one name="role" class="com.Blank.model.UserMag_b_RightTeam" fetch="select" >
<column name="role_id" not-null="true" />
</many-to-one>
而且我也都设置延迟加载了,在一的一方设置lazy="true"
plate:
<set name="rolepowers" inverse="true" lazy="true">
<key>
<column name="id" not-null="true" />
</key>
<one-to-many class="com.Blank.model.Role_Plate" />
</set>
role:
<set name="rolepowers" inverse="true" lazy="true">
<key>
<column name="role_id" not-null="true" />
</key>
<one-to-many class="com.Blank.model.Role_Plate" />
</set>
问题是现在我在用户action中想提取
result= this.userRoleService.getRoleFun(roleid);//返回功能与角色集合
现在这个result里面存了2个对像,一个是plate,role但是看他们对象里面的属性值都是空的,而且
ERROR - Servlet.service() for servlet jsp threw exception
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
怎么解决啊!!!