views:

251

answers:

1

i found an error whenever i am calling oracale stordeprocedure from class using isession this is my mappping file

 <hibernate-mapping
 xmlns="urn:nhibernate-mapping-2.2" default-access="field"
 assembly="DataContext" namespace="DataContext" >


 <sql-query name="GetEmployeedetails" callable="true">
    <return alias="emp" class="empdetails"  >
        <return-property name="U_ID" column="U_ID"/>
            <return-property name="IUSR_FIRST_NAME" column="IUSR_FIRST_NAME"/>
              <return-property name="IUSR_LAST_NAME" column="IUSR_LAST_NAME"/>
        <return-property name="IUSR_EMP_EMAIL_ID" column="IUSR_EMP_EMAIL_ID"/>
            <return-property name="IUSR_MOBILE_NO" column="IUSR_MOBILE_NO"/>
        <return-property name="IUSR_REMARKS" column="IUSR_REMARKS"/>
            <return-property name="IUSR_LOGIN_NAME" column="IUSR_LOGIN_NAME"/>


    </return>
    {?=call GETEMPLOYEEDETAILS(:pr_page,:pr_userid) }

  </sql-query>

</hibernate-mapping>

this is my class file

amespace DataContext
{
    public class empdetails 
    {
        public int _ID;
        private string _IUSR_FIRST_NAME;
        private string _IUSR_LAST_NAME;
        private string _IUSR_EMP_EMAIL_ID;
        private string _IUSR_MOBILE_NO;
        private string _IUSR_REMARKS;
        private string _IUSR_LOGIN_NAME;
       // private DateTime _IUSR_CREATED_ON;


        //public empdetails(int U_ID, string IUSR_FIRST_NAME, string IUSR_LAST_NAME, string IUSR_LOGIN_NAME, string IUSR_EMP_EMAIL_ID, string IUSR_MOBILE_NO, string IUSR_REMARKS)//, DateTime iusrcreated)
        //{
        //    this._ID = U_ID;
        //   // _IUSR_FIRST_NAME = iusrfname;
        //    this._IUSR_FIRST_NAME = IUSR_FIRST_NAME;
        //    this._IUSR_LAST_NAME = IUSR_LAST_NAME;
        //    this._IUSR_LOGIN_NAME = IUSR_LOGIN_NAME;
        //    this._IUSR_EMP_EMAIL_ID = IUSR_EMP_EMAIL_ID;
        //    this._IUSR_MOBILE_NO = IUSR_MOBILE_NO;
        //    this._IUSR_REMARKS = IUSR_REMARKS;
        //    //  _IUSR_CREATED_ON = iusrcreated;

        //}

        public empdetails()
        {
        }
        public virtual int U_ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        public virtual string IUSR_FIRST_NAME
        {
            get { return _IUSR_FIRST_NAME; }
            set
            {
                _IUSR_FIRST_NAME = value;
            }

        }
        public virtual string IUSR_LAST_NAME
        {
            get { return _IUSR_LAST_NAME; }
            set
            {
                _IUSR_LAST_NAME = value;
            }

        }
        public virtual string IUSR_LOGIN_NAME
        {
            get { return _IUSR_LOGIN_NAME; }
            set
            {
                _IUSR_LOGIN_NAME = value;
            }

        }
        public virtual string IUSR_EMP_EMAIL_ID
        {
            get { return _IUSR_EMP_EMAIL_ID; }
            set
            {
                _IUSR_EMP_EMAIL_ID = value;
            }


        }
        public virtual string IUSR_MOBILE_NO
        {
            get { return _IUSR_MOBILE_NO; }
            set
            {
                _IUSR_MOBILE_NO = value;
            }

        }
        public virtual string IUSR_REMARKS
        {
            get { return _IUSR_REMARKS; }
            set
            {
                _IUSR_REMARKS = value;
            }

        }

    }

my controler class

 public ActionResult Index()
        {
          //  OracletestModule ot=new OracletestModule();
          //ot.GETEMPDETAILS(17);
          //return View(ot);

            ISessionFactory factory = new NHibernate.Cfg.Configuration().Configure().BuildSessionFactory();
            using (ISession session = factory.OpenSession())
            {


                var namedQuery = session.GetNamedQuery("GetEmployeedetails");
                namedQuery.SetParameter("pr_userid", 17);
                // IList list = namedQuery.List();
                IList list = (IList)namedQuery.List();
                return View();
            }


        }

oracle stored procedure

create or replace
PROCEDURE GETEMPLOYEEDETAILS 
(
pr_page out SYS_REFCURSOR,
pr_userid test.U_ID%TYPE


)
AS
BEGIN
open  pr_page for 
select
       U_ID,
       IUSR_FIRST_NAME,  
       IUSR_LAST_NAME,
       IUSR_EMP_EMAIL_ID,
       IUSR_MOBILE_NO, 
       IUSR_REMARKS, 
       IUSR_LOGIN_NAME

from test where U_ID= pr_userid;
END GETEMPLOYEEDETAILS;

plz help me what i did mistake

thanks in advance

A: 

This error typically occurs when you are querying for an unmapped class. Do you have a mapping file for empdetails?

Jamie Ide
thanks for u r replay i copied class file empdetails also plz check it plz give me a proper solution
sandeep
I see the empdetails class but I don't see an NHibernate mapping file for empdetails. If empdetails isn't mapped then you will get this error. See this question if you want to use a query with an unmapped class: http://stackoverflow.com/questions/660820/using-unmapped-class-with-nhibernate-named-query.
Jamie Ide
where to create and use nhibernate mapping file plz give me a example thank you vary much?
sandeep