日期:2014-05-17 浏览次数:20747 次
<set name="zqAdminModuleses" table="zq_admin_modules_permission" lazy="false">
<key>
<column name="admin_permission_id" length="36" not-null="false" />
</key>
<many-to-many column="admin_modules_id" class="com.zqqywssh.vo.ZqAdminModules"></many-to-many>
</set>
<set name="ZqAdminPermissions" inverse="true" table="zq_admin_modules_permission">
<key>
<column name="admin_modules_id" length="36" not-null="false" />
</key>
<many-to-many column="admin_permission_id" class="com.zqqywssh.vo.ZqAdminPermission"></many-to-many>
</set>
public ZqAdminPermission findById(final String id) {
ZqAdminPermission zqAdminPermission = getHibernateTemplate().execute(new HibernateCallback<ZqAdminPermission>() {
public ZqAdminPermission doInHibernate(Session session) throws HibernateException,SQLException {
String hql = "from ZqAdminPermission zap where zap.adminPermissionId=:id";
Query query = session.createQuery(hql);
query.setString("id", id);
List list = query.list();
if(list.size()==0) return null;
return (ZqAdminPermission)list.get(0);
}
});
return zqAdminPermission;
}