1 failed to lazily initialize a collection of role: com.gmako.entity.UserInfo.extendsUserInfos, no session or session was closed
這是懶加載異常 配置文件設置lazy爲false
<set name="sysuser"" inverse="true" lazy-="false">
<key>
<column nam"xxid"/>//主鍵ID
</key>
<one-many class="pojo.sysuser">
</set>
=================================================
多對多關係配置
private Set<SysRight>sysRight=new HashSet(0);
//table 是數據庫中存有兩者關係的表名
<set name="sysRight" table="sys_role_right" lazy="false" inverse="true">
<key>
//自己表在連接表中的列名
<column name="roles_id">
</key> //對方表在連接表中的列名
<many-to-many column="right_id" class="pojo.SysRight"></many-to-many>
</set>