首页新闻找找看学习计划

多对一,查询的时候没有自动关联

0
悬赏园豆:20 [待解决问题]
using System;

//Nhibernate Code Generation Template 1.0
//author:MythXin
//blog:www.cnblogs.com/MythXin
//Entity Code Generation Template
namespace Domain{
         //管理员信息表
        public class Manager
    {
    
          /// <summary>
        /// 自增ID
        /// </summary>
        public virtual int id
        {
            get; 
            set; 
        }        

        public virtual int? role_id
        {
            get;
            set;
        }

        public virtual Manager_role Manager_role
        {
            get;
            set;
        }
        /// <summary>
        /// 管理员类型1超管2系管
        /// </summary>
        public virtual int? role_type
        {
            get; 
            set; 
        }        
        /// <summary>
        /// 用户名
        /// </summary>
        public virtual string user_name
        {
            get; 
            set; 
        }        
        /// <summary>
        /// 登录密码
        /// </summary>
        public virtual string password
        {
            get; 
            set; 
        }        
        /// <summary>
        /// 6位随机字符串,加密用到
        /// </summary>
        public virtual string salt
        {
            get; 
            set; 
        }        
        /// <summary>
        /// 用户昵称
        /// </summary>
        public virtual string real_name
        {
            get; 
            set; 
        }        
        /// <summary>
        /// 联系电话
        /// </summary>
        public virtual string mobile
        {
            get; 
            set; 
        }        
        /// <summary>
        /// 电子邮箱
        /// </summary>
        public virtual string email
        {
            get; 
            set; 
        }        
        /// <summary>
        /// 是否锁定
        /// </summary>
        public virtual int? is_lock
        {
            get; 
            set; 
        }        
        /// <summary>
        /// 添加时间
        /// </summary>
        public virtual DateTime? add_time
        {
            get; 
            set; 
        }        
           
    }
}

 

<?xml version="1.0"  encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Domain" namespace="Domain">
    <class name="Manager" table="Manager">
        <id name="id" column="id" type="int" unsaved-value="0">
                  <generator class="native" />                   
          </id>                  
    <many-to-one name="Manager_role" column="role_id"  cascade="all" />
    
        <property name="role_type" column="role_type" type="int"  />
        <property name="user_name" column="user_name" type="string"  />
        <property name="password" column="password" type="string"  />
        <property name="salt" column="salt" type="string"  />
        <property name="real_name" column="real_name" type="string"  />
        <property name="mobile" column="mobile" type="string"  />
        <property name="email" column="email" type="string"  />
        <property name="is_lock" column="is_lock" type="int"  />
        <property name="add_time" column="add_time" type="DateTime"  />
                
    </class>
</hibernate-mapping>

管理员表,关联角色表,一个角色对应多个管理员,属于一对多的关系,查询的时候,并没有关联查询,请问怎么回事呢? 有没有这方面的交流群,遇到问题好难解决啊.....

提伯斯的主页 提伯斯 | 初学一级 | 园豆:86
提问于:2016-11-14 17:28
< >
分享
所有回答(1)
0

http://blog.csdn.net/soldierluo/article/details/4715481

设置成立即加载

提伯斯 | 园豆:86 (初学一级) | 2016-11-14 18:14
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册